Table 'members' has the following fields: MAJOR_KEY, EMAIL
Table 'webMembers' has the following fields: MAJOR_KEY, PASSWORD, EMAIL, ACTIVE
The 'members' table gets updated weekly, and the 'webMembers' table is supposed to have all the same records as the 'members' table. I need to do and insert that takes any new records from 'members' that don't match up with the records already in the 'webMembers' table and inserts them into the 'webMembers' table. Any records that do get inserted into 'webMembers' would just need NULL values for the PASSWORD and ACTIVE fields.
The SQL I'm using isn't accomplishing this task. I get an error: "Column name or number of supplied values does not match the table definition"
Can this only be done if both tables have the same fields?
Anyone know how to do this?
Here's the SQL statement I'm using:
INSERT INTO webMembers
SELECT m1.major_key, m1.email
FROM members m1 LEFT OUTER JOIN webMembers w1 ON m1.major_key = w1.major_key
WHERE w1.major_key IS NULL
Table 'webMembers' has the following fields: MAJOR_KEY, PASSWORD, EMAIL, ACTIVE
The 'members' table gets updated weekly, and the 'webMembers' table is supposed to have all the same records as the 'members' table. I need to do and insert that takes any new records from 'members' that don't match up with the records already in the 'webMembers' table and inserts them into the 'webMembers' table. Any records that do get inserted into 'webMembers' would just need NULL values for the PASSWORD and ACTIVE fields.
The SQL I'm using isn't accomplishing this task. I get an error: "Column name or number of supplied values does not match the table definition"
Can this only be done if both tables have the same fields?
Anyone know how to do this?
Here's the SQL statement I'm using:
INSERT INTO webMembers
SELECT m1.major_key, m1.email
FROM members m1 LEFT OUTER JOIN webMembers w1 ON m1.major_key = w1.major_key
WHERE w1.major_key IS NULL