Igor Tandetnik wrote:
>
> Barry1337 wrote:
>> So I need, for every record in STAYSPEC, to find another record in
>> STAYSPEC
>> that has the same STAYNUM field and an ORDER_SPEC field that is 1 more. I
>> want to replace the date_out from STAYSPEC with that date
I have the following query:
Code:
UPDATE STAYSPEC SET date_out =
CASE WHEN EXISTS
(SELECT *
FROM STAYSPEC AS STAYSPEC2
WHERE (STAYSPEC2.STAYNUM = STAYSPEC.STAYNUM) AND
(STAYSPEC2.ORDER_SPEC = STAYSPEC.ORDER_SPEC+1))
THEN
(SELECT date_in FROM STAYSPEC AS STAYSPEC
2 matches
Mail list logo