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 |
|
j-in-nz
Starting Member
17 Posts |
Posted - 2007-03-26 : 19:07:38
|
| UPDATE workflow SET Flag = CASE WHEN @Review = 1 then DateQueryRaised Case When DateToReview is not null then coalesce(DateQueryRaised,DateToReview) When DateToReview is null then TestDate END WHEN @Review=2 then Case When DateToPrelimReview is not null THEN coalesce(DateQueryRaised,DateToPrelimReview) ENDENDI need to change my update statement to include the 2nd field to be DateQueryRaised from another table as per this statement:Select q.DateQueryRaised from Workflow winner join WorkflowQuery q ON w.OID = q.Workflowpls assistand q.DateQueriesResolved is not null |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-03-27 : 07:33:56
|
| UPDATE workflow SET Flag = CASEWHEN @Review = 1 then q.DateQueryRaisedCase When w.DateToReview is not null then coalesce(q.DateQueryRaised,w.DateToReview)When w.DateToReview is null then w.TestDateENDWHEN @Review=2 thenCase When w.DateToPrelimReview is not null THEN coalesce(q.DateQueryRaised,w.DateToPrelimReview) ENDENDfrom Workflow winner join WorkflowQuery q --left outer join WorkflowQuery q ON w.OID = q.WorkflowThis would need to be a left outer join if the entry in WorkflowQuery might not be there.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|