我在PHP中运行了以下查询,效果很好。
SELECT * FROM transactions LEFT JOIN actions ON transactions.id_transaction_id = actions.id_transaction_id where transactions.server_datetime_trans >= '2017-11-07 12:00:00' AND transactions.server_datetime_trans <='2017-11-07 12:59:59'
但我尝试在laravel中运行相同的查询。它不起作用,始终显示empty array()
尝试了两种类型的Laravel代码:
TYPE 1 ::
$data=DB::select(DB::raw("SELECT * FROM transactions LEFT JOIN actions ON transactions.id_transaction_id = actions.id_transaction_id where transactions.server_datetime_trans >= '2017-11-07 12:00:00' AND transactions.server_datetime_trans <='2017-11-07 12:59:59'"));
print_r($data);
TYPE 2 ::
$data=DB::select("SELECT * FROM transactions LEFT JOIN actions ON transactions.id_transaction_id = actions.id_transaction_id where transactions.server_datetime_trans >= '2017-11-07 12:00:00' AND transactions.server_datetime_trans <='2017-11-07 12:59:59'");
print_r($data);
两者都显示empty array()
作为结果