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 |
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2013-02-13 : 17:08:37
|
Is there a way to find teh unique combination of columns based on table data:i have the following table with 260k rows, now i want to see the best combination of columns which make the row unique.is it possible?I have loaded the data from another system now want to see CREATE TABLE [dbo].[LAW_DEL_IMGNOW_GLACCT_FIRST]([TABLE_NAME] [varchar](50) NULL,[ACTIVE] [varchar](1) NULL,[BUSINESSUNITID] [int] NULL,[COST_CENTER] [int] NULL,[GLACCT] [int] NULL,[GLSUBACCT] [int] NULL,[GLACCTDESC] [varchar](250) NULL,[GLACCT5] [varchar](250) NULL,[GLACCT6] [varchar](250) NULL) ON [PRIMARY]Thanks a lot for the helpful info. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-13 : 23:38:59
|
for that you need to take each set of columns you think would make a unique combination and do likeSELECT COL1,COL2,COL3FROM tableGROUP BY Col1,Col2,Col3HAVING COUNT(*) >1 if this returns any result then it means combination has duplicates------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2013-02-14 : 08:25:58
|
Thanks Visakh |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-14 : 10:04:46
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|