Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 More than one row

Author  Topic 

wshtrue
Yak Posting Veteran

74 Posts

Posted - 2005-04-15 : 17:03:04
Hello,
I have first name column and there are many names.I just want to see those names which are in more than one row.For an example if i have first name as a,b,c,a,b,d so i need to see only rows where there are more than one value so it should show me a and b.Thank you in advance
R,

nathans
Aged Yak Warrior

938 Posts

Posted - 2005-04-15 : 17:16:52
try this:


DECLARE @test TABLE (test_name varchar(10))
INSERT INTO @test SELECT 'Nathan' UNION ALL SELECT 'Mike' UNION ALL SELECT 'Nathan'

SELECT test_name --, COUNT(*)
FROM @test
GROUP BY test_name
HAVING COUNT(*) > 1
Go to Top of Page
   

- Advertisement -