[SQL] update from join

2009-05-14 Thread Gary Stainburn
I know I should be able to do this but my brain's mashed today I have a stock table with s_stock_no varchar primary key s_vin varchar s_updated timestamp s_supercededboolean It is possible for the same vin to exist on stock if we have

Re: [SQL] update from join

2009-05-14 Thread Rob Sargent
I wonder if this works: update stock s set s_superceded = true where s.s_updated (select max(t.s_updated) from stock t where t.s_vin = s.s_vin) On Thu, May 14, 2009 at 7:27 AM, Gary Stainburn gary.stainb...@ringways.co.uk wrote: I know I should be able to do this but my brain's mashed

[SQL] Update from join

2006-07-07 Thread Gary Stainburn
I know this is probably a FAQ but Google etc hasn't helped. I have two tables, both with stock number and registration number in. The second table always has the correct stock number, the first doesn't. I want to copy the data across where the stock number is missing. The select with join

Re: [SQL] Update from join

2006-07-07 Thread Gary Stainburn
On Friday 07 July 2006 11:29, Gary Stainburn wrote: I know this is probably a FAQ but Google etc hasn't helped. I have two tables, both with stock number and registration number in. The second table always has the correct stock number, the first doesn't. I want to copy the data across where

Re: [SQL] Update from join

2006-07-07 Thread Michael Glaesemann
On Jul 7, 2006, at 6:29 , Gary Stainburn wrote: I have two tables, both with stock number and registration number in. The second table always has the correct stock number, the first doesn't. I want to copy the data across where the stock number is missing. The select with join shows the