解析错误:语法错误,意外的'F'(T_STRING),期望为','或')'

时间:2018-06-21 02:27:13

标签: laravel laravel-5

`$data['top_argo'] = \DB::select( \DB::raw('select DISTINCT SUM(transaction.total) as total_argo, COUNT(transaction.id) as total_trans, users.name FROM transaction LEFT JOIN CUSTOMER ON customer.id = transaction.id_driver_fk LEFT JOIN users ON users.id = customer.id_user_fk WHERE id_customer_fk IS NOT NULL AND transaction.status = 'F' GROUP B`Y users.name   ORDER BY SUM (transaction.total) DESC LIMIT 10'));

我需要在我的laravel上运行此查询,但是出现了一个错误,如标题上所述。我是laravel的新手,所以您能帮我吗?

2 个答案:

答案 0 :(得分:1)

您的查询有很多语法错误。不要使用双引号而不将其绑定为字符串。

x <- c(0.0, -3.2, 4.2)
sprintf("%+3d %%", x)
#[1] " +0 %" " -3 %" " +4 %"

sprintf("%+3.1f %%", x)
#[1] "+0.0 %" "-3.2 %" "+4.2 %"

答案 1 :(得分:0)

要解决此异常,请将'F'替换为\'F\'