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 |
What is IQD file?
how to find the 5th highest salary form each department using 1.SQL Query 2. Informatica power center designer?
In a scenario I want to change the dimensions of a table and normalize the denomralized table which transformation can I use?
from Source 100 rows are coming, on target there are 5 m rows which options is better to match data 1. Joiner 2 No cache 3. Static 4. Dynamic
Roles and Responsibilties of Informatica Production Support Member?
What is a surrogate key?
why union is active transformation?
How do you manage the Parameter files while migrating your data from one environment to another environment?
What is Index Caches size?
Q. In source area, it is use complex query we have using 5 to 10 table we has been join now all join clolumn having indexes but still we having performance issue. how to fix the performnce issue of the query.
How can we integrate different flat file data in a single mapping and with in a single execution
Can we update the data in flat file using update strategy?