我用一个已经有效的函数发出了一个SQL请求,看起来像这样:
SELECT fnStripTags('this <html>is <b>a test</b>, nothing more</html>');
执行此SQL代码时:
INSERT INTO `ps_product_lang` (`description`) VALUES (
SELECT fnStripTags(description) FROM ps_product_lang
WHERE ps_product_lang.id_lang = id_lang AND ps_product_lang.id_product = id_product
) WHERE description IS NOT NULL
我收到了这个错误:
1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'SELECT fnStripTags(ps_product_lang.description) FROM
ps_product_lang WHERE ps_pr' at line 1
答案 0 :(得分:0)
insert-select
语句中没有values
个关键字:
INSERT INTO ps_product_lang (description)
SELECT fnStripTags(description)
FROM ps_product_lang
WHERE ps_product_lang.id_lang = id_lang AND
ps_product_lang.id_product = id_product AND
description IS NOT NULL
答案 1 :(得分:0)
试试这个..插入语句
需要values
INSERT INTO ps_product_lang (description)
SELECT fnStripTags(description)
FROM ps_product_lang
WHERE ps_product_lang.id_lang = id_lang
AND ps_product_lang.id_product = id_product
And description IS NOT NULL