Chaostryder
Chaostryder

Reputation: 223

ms access 2003 update query sql not working properly

the query is this :

UPDATE ParametersMain2 INNER JOIN ParametersMain ON ParametersMain2.VMV_CODE=ParametersMain.VMV_CODE SET ParametersMain2.PARENT_VARIABLE_NAME=ParametersMain.PARENT_VARIABLE_NAME AND ParametersMain2.VARIABLE_NAME=ParametersMain.VARIABLE_NAME;

Each time it says all the entries are being updated. each time i go look. the PARENT_VARIABLE_NAME fields and VARIABLE_NAME fields are still blank in ParametersMain2. and the entire column of those fields are filled in in ParametersMain

why isntit working? i checked to see that its all the same data types and formats between the two tables.

Upvotes: 0

Views: 393

Answers (1)

Stephen Turner
Stephen Turner

Reputation: 7314

Swap the AND with a comma, as below.

UPDATE 
    ParametersMain2 

        INNER JOIN 
    ParametersMain 
        ON ParametersMain2.VMV_CODE = ParametersMain.VMV_CODE
SET 
    ParametersMain2.PARENT_VARIABLE_NAME = ParametersMain.PARENT_VARIABLE_NAME , 
    ParametersMain2.VARIABLE_NAME = ParametersMain.VARIABLE_NAME;

AND is operator that combines booleans (and nulls), if you want to set multiple fields separate them with a comma.

Upvotes: 2

Related Questions