May 26, 2011 at 8:46 am
Hello - I'm new to this so bare with me! I'm stuck on the subquery at the end here. It seems to only carry out the greater than on one value from my subquery.. any ideas? Let me know if this makes no sense at all!
Thanks to anyone who can help.
Chris.
update
#SLA2_EvidToDesn
set
app_date =
(
select min(ENDDATTIM)
from w20u999s a
where a.CRDATTIM = #SLA2_EvidToDesn.CRDATTIM
and a.ENDSTATCD in ('UW','REFERUW')
and a.ENDDATTIM > (select max (enddattim) from w20u999s w20 where w20.crdattim = #SLA2_EvidToDesn.crdattim and endstatcd = 'evidhold')
)
May 26, 2011 at 8:56 am
Are you sure the error's comming from there? I don't see anything that could produce more than 1 row there.
May 26, 2011 at 12:36 pm
Are you saying that #SLA2_EvidToDesn has more than 1 row and that after you run this update all rows have the same value for app_date?
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
May 27, 2011 at 1:27 am
That's it yes, I think that actually answers my question though - it was my logic that was wrong!
Will have another go at it. Ta very much
May 27, 2011 at 7:10 am
Let us know if want/need some help.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply