为什么我的 sql 查询在我输入 laravel 时出现此错误
why my sql query have this error when i put into laravel
$personalSale = DB::select(DB::raw("SELECT *
FROM purchases a
WHERE a.purchase_status IN (3001,3002,3003,4000,4001,4002,4003) AND
a.purchase_date LIKE "%12/2020" AND
(a.user_id = 50 OR a.user_id in (SELECT b.user_id
FROM user_infos b
WHERE b.referrer_id = 1911000140))
ORDER BY a.purchase_amount DESC
LIMIT 10;
"));
error:
syntax error, unexpected '" AND ' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')'
LIKE "%12/2020" 尝试将 from " 替换为 '
$personalSale = DB::select(DB::raw("SELECT *
FROM purchases a
WHERE a.purchase_status IN (3001,3002,3003,4000,4001,4002,4003) AND
a.purchase_date LIKE "%12/2020" AND
(a.user_id = 50 OR a.user_id in (SELECT b.user_id
FROM user_infos b
WHERE b.referrer_id = 1911000140))
ORDER BY a.purchase_amount DESC
LIMIT 10;
"));
error: syntax error, unexpected '" AND ' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ')'
LIKE "%12/2020" 尝试将 from " 替换为 '