We have two tables table1 table2
In table1
Itemnumber SalesCode
123 213UB
142 132NB
1458 256GD
In table2
Itemnumber ProductGroupCode
123
142
1458
After Update table2 We need Like this
Itemnumber ProductGroupCode
123 213UB
142 132NB
1458 256GD
We tried like this
tx.executeSql('UPDATE table2 JOIN table1 ON (table2.ItemNumber=table1.ItemNumber) SET table2.CustomerPriceGroup = table1.SalesCode');
But We got error like this
Colud not prepare Statement (Near "JOIN ":syntax error)
Please tell me what wrong in my code
SQLite doesn't support JOINs in UPDATE statements.
You can reach the same result using sub-query like the following
UPDATE table2
SET table2.CustomerPriceGroup =
(SELECT table1.SalesCode FROM table1 WHERE table2.ItemNumber=table1.ItemNumber)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments