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.
Author |
Topic |
ram.marella
Starting Member
15 Posts |
Posted - 2008-06-06 : 17:54:37
|
i have the following scenarioTablASeg Team----------------10 A10 B10 C11 AA12 Cc12 DdI want to get the output like as follows:Seg Team-------------10 A10 B10 C12 Cc12 DdI want to get the duplicated rows based on the seg column?Thanks-----------------Ram MCP |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
ram.marella
Starting Member
15 Posts |
Posted - 2008-06-06 : 19:33:48
|
Thanks Tara for your reply,but it is giving disticnt rows based on two columns. But i want to eliminate the unique rows and need to display duplicate rows based on two columns.Thanks-----------------Ram MCP |
 |
|
ram.marella
Starting Member
15 Posts |
Posted - 2008-06-06 : 19:43:18
|
i can put my requirement in simple manner like as follows:i have to select rows from tableA whihc is having Col1,Col2,Col3 where Col2 value count > 1. i.E in out put rows the Col2 values should be repeated more than once.Thanks-----------------Ram MCP |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-06-07 : 00:34:38
|
My query should produce your output. If you have a more complex problem, then please post better data so that we can understand your issue.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-07 : 04:31:34
|
quote: Originally posted by ram.marella i can put my requirement in simple manner like as follows:i have to select rows from tableA whihc is having Col1,Col2,Col3 where Col2 value count > 1. i.E in out put rows the Col2 values should be repeated more than once.Thanks-----------------Ram MCP
SELECT Seg, TeamFROM YourTable WHERE Seg IN(SELECT SegFROM YourTableGROUP BY SegHAVING COUNT(*) > 1) OR SELECT t.Seg, t.TeamFROM YourTable tINNER JOIN (SELECT SegFROM YourTableGROUP BY SegHAVING COUNT(*) > 1)tmpON tmp.Seg=t.Seg |
 |
|
|
|
|