I am having a table with columns
ID NAME
1 x and the requirement is to get the o/p like this
1 y ID Count(*)
1 z 1 3
2 a 2 2
2 b
3 c
so write a sql query to get the id n how many times its
count of repetition n there u shouldn't get the distinct(i.e
id-3)
Reply as early as possible
Answers were Sorted based on User's Feedback
Answer / ruchi
SELECT ID,COUNT(*) FROM TABLE1
GROUP BY ID
HAVING COUNT(*)>1
| Is This Answer Correct ? | 9 Yes | 0 No |
Answer / sambu
select id,count(*) from <table name>
group by id having count(*)>1;
The above gives us desired output
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / akash khanwalkar
This one is without using HAVING clause:
SELECT TEMP.ID, TEMP.ID_COUNT FROM
(
SELECT ID AS ID, COUNT(ID) AS ID_COUNT FROM TEMP_ID_TABLE
GROUP BY ID
) TEMP
WHERE TEMP.ID_COUNT > 1;
| Is This Answer Correct ? | 2 Yes | 0 No |
How to create or implement slowly changing dimension (SCD) Type 2 Effective Date mapping in informatica/Flagging mapping in informatica/visioning mapping in informatica?
What are active and passive transformations?
While importing the relational source definition from the database, what are the metadata of source that will be imported?
what is the size of ur database(like oracle)
can i any one explain me realtime healthcare project explanation..for interview .iam new to informatica .thanks in advance.
i have to extract data from a flat file.the flat file has 10 records.i have to extract the 1st and 5th record every time.how is it done.
What is a predefined event?
How to extract sap data using informatica? What is abap? What are idocs?
What are ETL Tools?
in which situations do u go for starflake schema ?
How does the server recognize the source and target databases. Elaborate on this.
For stage table data processing, suppose in first run we processed 8 records out of 10 records then in 2nd run we should consider only not processed records (here total no of records =2) along with new records which got loaded in stage table thru real time mapping. Note : In this example, 8 records are those records for which we got transaction number after lookup on trn_no_cod table and 2 records for which lookup returns trn_no as NULL