[thelist] sql update statement using a subquery (sql server)
Ken Moore
psm2713 at hotmail.com
Tue May 29 14:59:20 CDT 2007
Hi all,
r937" <rudy at r937.com asked:
>does this work correctly?
>
That would depend on what you are trying to do :-)
Try something like this:
UPDATE Reservations
SET ReservedBy = r2.ReservedBy
FROM ReservedBy r, ReservationIDs r2
WHERE r.ParentReservationID = r2.ReservationID
AND r.ReservedBy IS NULL;
My SQL compiler does not work very well in emals but I think this is close.
Ken
>UPDATE Reservations
> SET ReservedBy = r2.ReservedBy
> FROM Reservations r
>inner
> join Reservations r2
> on r.ParentReservationID = r2.ReservationID
> WHERE r.ReservedBy IS NULL
>
>
>rudy
>http://r937.com/
_________________________________________________________________
More photos, more messages, more storageget 2GB with Windows Live Hotmail.
http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HM_mini_2G_0507
More information about the thelist
mailing list