1
我想這個簡單的SQL查詢Laravel4.2:口才 - 使用DATE_FORMAT在SQL查詢
SELECT DATE_FORMAT(my_date, '%m-%d-%Y') FROM my_tbl WHERE id = 1
雄辯像
$tbl = DB::table('my_tbl');
$tbl->select('DATE_FORMAT(my_date, "%m-%d,-%Y")');
$tbl->where('id', "=", 1);
Datatable::query($tbl);
,但它接受作爲字符串,並拋出錯誤:
{"error":{"type":"Illuminate\\Database\\QueryException","message":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'DATE_FORMAT(arrival, \"%d %M, %Y\")'