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 |
|
zubairmasoodi
Starting Member
35 Posts |
Posted - 2009-10-21 : 07:22:42
|
| Hi allI have a table with two columns C1 and C2. I need a Query which can check if we have duplicate values for C2 corresponding to any C1 in my table. Column C1 is Foreign key to a certain table. thanks in advancezubWith regardsZubair Masoodi (Every day's a school day) |
|
|
sanoj_av
Posting Yak Master
118 Posts |
Posted - 2009-10-21 : 07:53:27
|
| Select col1,col2,count(1) from TableGroup by col1,col2having Count(1)>1 |
 |
|
|
zubairmasoodi
Starting Member
35 Posts |
Posted - 2009-10-21 : 08:24:43
|
| Thanks sanojWith regardsZubair Masoodi (Every day's a school day) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-10-21 : 12:29:54
|
| should that be Select col1,count(col2) from TableGroup by col1having Count(col2)>1 |
 |
|
|
|
|
|