Reputation: 43
Whats wrong with this SQLite statement?
update HOME_TEMP ab
set ab.REALIMEI=(select substr(cd.IMEI ,1,14) from HOME_TEMP cd where ab.MSISDN=cd.MSISDN)
SQL Error [1]: [SQLITE_ERROR] SQL error or missing database (near "ab": syntax error)
Upvotes: 0
Views: 82
Reputation: 52419
You need to use AS
to alias the table being updated (And it's not recognized (Or needed) in the column name to set):
update HOME_TEMP AS ab
set REALIMEI=(select substr(cd.IMEI, 1, 14)
from HOME_TEMP cd
where ab.MSISDN=cd.MSISDN)
See the definition of a qualified-table-name
in the UPDATE
documentation.
Upvotes: 1
Reputation: 164099
It's not syntactically correct to alias the table that you want to update.
This is the correct syntax:
update HOME_TEMP
set REALIMEI=(
select substr(cd.IMEI, 1, 14)
from HOME_TEMP cd
where HOME_TEMP.MSISDN = cd.MSISDN
)
Upvotes: 1