October 31, 2005 at 10:07 am
I have a table work which conisist of id column with duplicates values 'John'. one value is with status active and other value with status inactive. How to print duplicates values with status using Tsql.
Thanks in advance
October 31, 2005 at 10:11 am
I think we may need more information, but here is a start:
SELECT [id], COUNT( [id]), OtherFields
FROM MyTable
GROUP BY [id], OtherFields
HAVING COUNT( [id]) > 1
I wasn't born stupid - I had to study.
October 31, 2005 at 10:16 am
-- if you want to see the statuses of the duplicates, do a self join:
-- pubs db
-- get titles with multiple authors only
select distinct
ta1.title_id,
ta1.au_id,
ta2.au_id
from
titleauthor ta1
join
titleauthor ta2 on ta1.title_id=ta2.title_id and ta1.au_id <> ta2.au_id
November 2, 2005 at 11:06 pm
select empname from employee group by empname HAVING count(empname) > 1
my mail id : ravi_friends_heart@yahoo.com
ANRK
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply