views:

460

answers:

1

We've got a table of places. The same place may occur multiple times in our table (bad design, not our choice). We had someone go through and find addresses for each of these places. They only updated one of the many instances of each place.

Here is a query that does NOT work, but I think shows what I am trying to do.

update places set address1 = places2.address1 
inner join places places2 ON places.placename = places2.placename 
where (places2.address1 <> '' AND places2.address1 is not null)

Anyone want to give me a nudge in the right direction?

+8  A: 
update places set address1 = places2.address1 
from places inner join places places2 ON places.placename = places2.placename 
where (places2.address1 <> '' AND places2.address1 is not null)
Arvo
Ummm...so my whole problem was that I didn't have "from places"? Well...damn.Thanks! Worked perfectly!
Matt Dawdy