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 |
|
pgmr1998
Yak Posting Veteran
66 Posts |
Posted - 2011-02-11 : 17:02:53
|
| I have a case where there are two documents that are retrieved from my select statement, but I want only to retrieve the first one, although both should have been returned. The reason that I want only the first one is that I will have to update the first record only in all cases where I get duplicates, such as this case. How can I return the first doc when duplicates are found? |
|
|
dataguru1971
Master Smack Fu Yak Hacker
1464 Posts |
Posted - 2011-02-11 : 17:19:57
|
You have a couple of issues...What will identify the 1st record from the 2nd?If you identify a record which needs updating, and then update "that" record..if both match the criteria, both will be updated.What version of SQL are you using?And please post DDL, sample data and desired result... Poor planning on your part does not constitute an emergency on my part. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-02-12 : 03:21:10
|
| do you have a unique valued field (id or date field) which enables you to identify 1st 2nd etc records?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|