subqueries in UPDATE SET (sql server 2005)

Posted by itdebeloper on Stack Overflow See other posts from Stack Overflow or by itdebeloper
Published on 2010-04-06T16:27:47Z Indexed on 2010/04/06 16:33 UTC
Read the original article Hit count: 164

Filed under:
|
|

I have a question about using subqueries in an Update statement. My example:

UPDATE TRIPS
   SET locations = city + ', ' FROM (select Distinct city 
                                       from poi 
                                      where poi.trip_guid = trips.guid) 

Is it possible to refer to main table value (trips.guid) in subqueries?

When i try to use trips.guid I get the error:

"The multi-part identifier "trips.guid" could not be bound."

© Stack Overflow or respective owner

Related posts about subquery

Related posts about sql-server-2005