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 |
In which transformation you cannot drag ports into it?
How to generate the HTML output using Informatica.
I have table name in that I have Rajesh Reshika Priya I want the result Like only Starting with R Rajesh Reshika Can someone help me to get these results and How?
Hi Experts, I have a source table like this. Name Number Raj 2 Ram 1 Sam 2 John 1 In the target I need the ouptput like the below Raj Raj Ram Sam Sam John We dont know the number value . It will be changing as n.. Please help me regarding this. Thanks, Nataraj V
write sql query following table quarter sales q1 1000 q1 2000 q1 3000 q1 4000 q2 5000 q2 6000 q2 7000 q2 8000 q3 1000 q3 2000 q3 3000 q3 4000 q4 5000 q4 6000 q4 7000 q4 8000 i want the output format like q1 q2 q3 q4 1000 5000 1000 5000 2000 6000 2000 6000 3000 7000 3000 7000 4000 8000 4000 8000
Performance wise which is better joiner or look up ? Give me with example?
Insert else update option in which situation we will use
Hi, source data is col1 values are 5,6,7 col2 are 3,2,1 col3 are 8,9,10 and i want to get target as col1 5,6,7 col2 1,2,3 col3 8,9,10 how to do this one?
What is a command that used to run a batch?
Aggregator transformation is having fields say a,b,c,d,e group by is enabled on a,b,c with sorted input,How the aggregator transformation process the i/p data?or in which way i/p comes to agg transformation
where to store informatica rejected data? How to extract the informatica rejected data?
where to select code page option?