下面的更新查詢不工作,而是選擇查詢裏面是:我的UPDATE查詢有子查詢有什麼問題?
UPDATE tb_alunos_detalhes A
SET A.ADTELALUNO = B.TEL
FROM B (
SELECT ADID ID,
(CASE
WHEN `ADTELALUNO` <> '' THEN (CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(`ADTELALUNO`, ' ', 1), ' ', -1), ' 9-', SUBSTRING(SUBSTRING_INDEX(SUBSTRING_INDEX(`ADTELALUNO`, ' ', 2), ' ', 10),6,10)))
ELSE ''
END) TEL
FROM tb_alunos_detalhes) B
WHERE A.ADID = B.ID
它給了我下面的錯誤:
Unexpected token. (near "(" at position 62) A new statement was found, but no delimiter between it and the previous one. (near "SELECT" at position 67) Unexpected token. (near ")" at position 381) Unexpected token. (near "B" at position 383)
我在做什麼錯?
我試圖改進問題和標題中的文字。還刪除標籤:PHP和SQL,因爲它只是關於MySQL – agold