View previous topic :: View next topic
|
Author |
Message |
Seppe
New User
Joined: 01 Apr 2009 Posts: 33 Location: Rome - Italy
|
|
|
|
hola,
i must update 3 columns (yesterday, today, tomorrow) of table XXX.
the correct value of 'today' in on another table YYY.
This is my actual:
update XXX
set today = (select today from yyy)
, yesterday = (select today from yyy) - 1 day
, tomorrow = (select today from yyy) + 1 day
;
Can I set a variable for the value of today?
I don't want do 3 select on yyy but only 1!
Thanks!!! |
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
I have to say I am not sure if this would work but can you try this:
update XXX
set (today, yesterday, tomorrow) = (select today, today - 1 day, today + 1 day from yyy)
;
Right now I don't have any means to test this but if you test (and it works) then please let me know ;-) |
|
Back to top |
|
|
Seppe
New User
Joined: 01 Apr 2009 Posts: 33 Location: Rome - Italy
|
|
|
|
Great!
It's perfect!
Thank you RahulG31 |
|
Back to top |
|
|
|