Re: How to INSERT values into 1 column from another table
Date: Tue, 12 Jun 2001 23:12:04 GMT
Message-ID: <8lxV6.141212$I5.38331894_at_news1.rdc1.tn.home.com>
If I understand correctly, you are not trying to INSERT records but rather, UPDATE existing records in the INVOICE table so that the COMMENTS column values are the same as the SHIP_METHOD column values of the associated records in the SHIPPING table.
OK, a little verbose...
Try something like this:
UPDATE invoice i
SET i.comments =
(
SELECT s.ship_method
FROM shipments s
WHERE s.invoice_id = i.invoice_id
)
Depending on the relationship(s) between the INVOICE and SHIPMENT table you may recieve a 'SINGLE RECORD SUB-QUERY RETURNED MORE THAN 1 ROW' (or something like that) error which may cause you to have to qualify the sub-query or the update further.
Good luck,
J.T. Patterson
"Unknown User" <unknown_at_unknown.com> wrote in message
news:elncito6d90u5kje48pvgc98fi8fr9b1c5_at_4ax.com...
> I added a column called COMMENTS to a table called INVOICE.
> I have another table called SHIPPING with a column called SHIP_METHOD
>
> I want to copy from shipping.ship_method to invoice.comments.
>
> How is it accomplished?
> I tried copy and insert into and would appreciate the proper syntax.
> Thank you.
Received on Wed Jun 13 2001 - 01:12:04 CEST