这条线有什么问题?
$query = "SELECT * FROM orders ORDER BY id DESC LIMIT 1000 WHERE TRIM(IFNULL(email,'')) <> ''";
基本上我想从sql获取所有不是空行的电子邮件
这是我的错误讯息:
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 'WHERE TRIM(IFNULL(email,'')) <> ''' at line 336
答案 0 :(得分:3)
ORDER BY id DESC LIMIT 1000
必须在WHERE
条件
$query = "SELECT * FROM
orders WHERE
TRIM(IFNULL(email,'')) <> ''
ORDER BY id DESC LIMIT 1000";
答案 1 :(得分:2)
您的WHERE
声明需要在FROM
声明后但在ORDER BY
(manual)之前声明:
SELECT *
FROM orders
WHERE TRIM(IFNULL(email,'')) <> ''
ORDER BY id DESC
LIMIT 1000";