Question : Insert into ... where problems

Hi Experts

I have a small problem.

i am trying to insert a birthday from one table to another with the following statement;

INSERT INTO consumerattributes( BirthDate )
SELECT 'birthday'
FROM customers
WHERE `consumerattributes`.`customerid` = `customers`.`customerId`

I get this error :
#1054 - Unknown column 'consumerattributes.customerid' in 'where clause'

What I'm trying to do is to populate the birthday field with the info from a older database,  therefor the WHERE `consumerattributes`.`customerid` = `customers`.`customerId`

I know that `consumerattributes`.`customerid` exist. - It works if i just use
WHERE `customerid` = `customers`.`customerId`
but it just inserts the data in new rows  :'(

I'm really hoping that you are able to help

:)

/DeviliX

Answer : Insert into ... where problems

Try this...

INSERT INTO consumerattributes([BirthDate])
SELECT Birthday FROM customers WHERE consumerattributes.customerid = customers.customerId
Random Solutions  
 
programming4us programming4us