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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-01-08 : 07:59:48
|
| Saikat writes "I have three columns and none of the columns is a primary key.Column a has duplicate values , Column b has duplicate values, Column c has fixed valued dor all the rows.I want to find unique observations for Cola, colb, colc.Regards," |
|
|
madhuotp
Yak Posting Veteran
78 Posts |
Posted - 2007-01-08 : 08:47:27
|
| select cola,colb,colc,count(cola),count(colb),count(colc) from <tablename> group by cola,colb,colc having count(cola)+count(colb)+count(colc)>3 the above statement will give u all duplicate composite cola+colb+colc valuenext statement will give u composite unique rowsselect cola,colb,colc,count(cola),count(colb),count(colc) from <tablename> group by cola,colb,colc having count(cola)+count(colb)+count(colc)=3 Madhu |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-08 : 09:12:02
|
| ???SELECT DISTINCT ColA, ColB, ColCFROM <YourTableNameHere>Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|
|
|