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-08-28 : 01:40:12
|
| hi delete query required in sql server 200o as it works fine with 2005.DELETE DFROM(SELECT *,ROW_NUMBER() OVER (PARTITION BY problem_code, patient_id ORDER BY PROBLEM_ID DESC) AS RowNumFROM EMRPATIENTPROBLEMS) DWHERE RowNum > 1GO |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-08-28 : 02:04:55
|
what is the primary key of the table ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-08-28 : 02:15:19
|
| problem_id |
 |
|
|
rajasekhar857
Constraint Violating Yak Guru
396 Posts |
Posted - 2009-08-28 : 02:42:07
|
| thanks i got itDELETEFROM emrpatientproblems_bakWHERE problem_id NOT IN(SELECT MAX(problem_id)FROM emrpatientproblems_bakGROUP BY problem_code,patient_id) |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-08-28 : 02:43:52
|
Thank you for the feedback. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|