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 |
|
befree
Starting Member
3 Posts |
Posted - 2001-02-06 : 20:39:41
|
| Hi,An query like the following one :SELECT DISTINCT column_name1, column_name2, column_name3 FROM table eliminates duplicate rows based on the =3= columns.What I want is to create a query which returns all the records that are duplicate on =only one= column.Ex : a query with no duplicate based only on userid on this table :Userid Session Dt_connect------ --------- -----------------------20107 578631748 2001-02-04 15:18:16.00020107 578631748 2001-02-04 15:19:50.00020107 578624023 2001-02-01 21:02:50.00020107 578624023 2001-02-01 21:03:21.00029605 578626716 2001-02-02 19:55:11.00029605 578626716 2001-02-02 19:55:27.000the query should give this result :Userid Session Dt_connect------ --------- -----------------------20107 578631748 2001-02-04 15:18:16.00020107 578624023 2001-02-01 21:02:50.00029605 578626716 2001-02-02 19:55:11.000In some SQL versions, you can use "DISTINCT ON" but I don't think MS SQL 2000 support this.How can I solve this problem ?-= BeFree =- |
|
|
|
|
|