Quantcast
Channel: SCN: Message List - SAP SQL Anywhere
Viewing all articles
Browse latest Browse all 2182

INSERT into table A based on SELECT from table B

$
0
0

I've been scratching my head (and a few other parts) for a while - maybe still brain dead from the clock forward thing :-)

 

Need to insert values where one of the fields is an ID number selected from another table, a bit like this

 

(SELECT Customer_ID FROM Customers WHERE Cust_Name LIKE '%Unique String%') AS Cust_ID

INSERT INTO A_Sales_Ledger(xxx, yyyy, Customer_ID) VALUES (yyyy, yyyy, Cust_ID)

 

So the select will return, say, 65 records and it will insert 65 new rows into A_Sales_Ledger with the corresponding Customer_ID

 

Thanks


Viewing all articles
Browse latest Browse all 2182

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>