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 the stock number is missing. The
> select with join shows the rows requiring update, but I can't think how to
> do the update.
>
I came up with:
goole=# update test1 set ud_stock=(select s_stock_no from test2 where
test1.ud_registration = test2.s_regno) where ud_stock ~ '^[NU][LD]$';
UPDATE 679
but as you can see, it updated a hell of a lot more than 21 rows.
Can anyone improve on this?
Gary
--
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000