我尝试从日期字段"fechas"(日期时间类型)检索月份,其中使用SQL子句MONTH进行测试不起作用...感谢回复
$data = DB::table("ordenes")
->select(array('*', DB::raw('((cant_ped)*(precio_unit)) as sum_pedidos'), DB::raw('((cant_pend)*(precio_unit)) as sum_pends'), DB::raw('((cant_rec)*(precio_unit)) as sum_recibidos'), DB::raw('(((cant_pend)*(precio_unit)) + ((cant_rec)*(precio_unit))) as sum_importe')))
->where('cod_prov', '<>', 0)
///////////// line ERROR
->where('MONTH(fecha)', '=', '06')
///////->where('MONTH(fecha)', '=', '2014-06-20') ///test OK
->groupBy('cod_prov')
->skip(Input::get("jtStartIndex"))
->take(Input::get("jtPageSize"))
->get();
Run Code Online (Sandbox Code Playgroud) 我有表 PEOPLE 的 id 列类型(CHAR 7),例如:
id name address
-------+------------------+---------
0010014 MUZZACHIODI FELIX SAN MARTIN
Run Code Online (Sandbox Code Playgroud)
我的控制器:
$people= People::find($id);
Run Code Online (Sandbox Code Playgroud)
查看返回整数:
{{ $people->id }} return 10014
Run Code Online (Sandbox Code Playgroud)
如何保持字符串ID?我试过 {!!$people->id !!} 或 (string)$people->id
预期输出:
0010014
Run Code Online (Sandbox Code Playgroud)