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 |
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2011-11-23 : 12:15:02
|
| Last item of the day and i'm OUT of here for the extended weekend! So ye who helps me with this will have the full gratitude of my family:I have a table (EVP_COC) which has multiple EVPNO rows with the same value that correspond to other columns. The column i need to update is the 'EVENT' column, HOWEVER i only need to place the value from the TEMPEVENT column in the last occurence for each EVPNO row. So i have a value of "CHECK OUT" in the TempEvent column which corresponds to EVPNO 'RCSO00EVP000001'. I have four rows which correspond to that EVPNO value, and i need to place the value in the TEMPEVENT column (corresponding to the EVPNO value) into the LAST row for that EVPNO value.how the heck is this going to happen?thanksjames |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2011-11-23 : 12:26:17
|
| Sorry, i meant to say i need to place the value FROM the tempevent column into the last corresponding entry in the EVENT column which relates to that EVPNO. |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-11-23 : 12:46:08
|
| What do you mean by last? do you have a datetime or identity or something?something likeupdate EVP_COCset TempEvent = eventfrom EVP_COC ejoin (select EVPNO, IDENTITY = max(id) from EVP_COC group by EVPNO) e2on e.EVPNO = e2.EVPNOand e.ID = e2.ID==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2011-11-23 : 12:55:27
|
| Good question. The customer has not done well in providing us coherent links between these fields. i think this is one i have to kick back to the customer to get them to clarify some of these vague relationship values. |
 |
|
|
|
|
|