Hi
I am having a few problems writing an insert statement.
I have a customer table with lookup values inserted in some of the columns which reference another table
customer table
name address1 status
test high street 0
lookup table
code description
0 deleted
1 customer
--
I need to insert data from the customer table into another but not us the lookup table, the statement i have written is:
insert into export (name,address1,status)
select name, address1, ( select descritption from lookup inner join customer on lookup.code = customer.status) from customer
The problem is the subquery is showing all rows from the customer table which is giving me a an error due to inserting multi values which i would expect, the question is how can get round this? row by row inserts if possble but sure how to do this.
Hi
Try
select c.name, c.address1, lu.descritption
from customer c
inner join lookup lu
on lu.code = c.status
|||Thanks for your help worked a treat
No comments:
Post a Comment