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 |
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-09-25 : 01:32:26
|
| hi iam having atable EMRLicensedRoleInfo having three columnsEMR_GROUP_ID varcharROLE_NAME varcharSTATUS numericiam having totally 845 records in it bit lot of duplicates in it.likeSELECT emr_group_id,count(*)FROM EMRLicensedRoleInfoGROUP BY emr_group_idHAVING count(*) > 1now i want to remove duplicates frpm that table.what is the query in doing so |
|
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-09-25 : 02:06:11
|
| GOT it just given select distinct * into table1 from EMRLicensedRoleInfo and drop the old table and passed new vales into the old table |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-09-25 : 06:10:53
|
| Hi, Take the backup for table and use following querydelete t from ( select row_number() over (partition by emr_group_id order by emr_group_id ) as rid from table ) twhere t.rid > 1select * from table |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-09-25 : 14:28:56
|
quote: Originally posted by Nageswar9 Hi, Take the backup for table and use following querydelete t from ( select row_number() over (partition by emr_group_id order by emr_group_id ) as rid from table ) twhere t.rid > 1select * from table
you cant take a backup of single table alone |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-09-25 : 23:03:00
|
| Hi,I mean create another table and insert the data into newtable after delete the records |
 |
|
|
|
|
|