Query
<?php
$vrec = DB::table('st_sales_live_bk')->where('brandid', $brandid)
->where('branchid', $branchid)
->where('module_id', 1)
->select(DB::raw('trunc(EODATE)'))
->get();
return $vrec;
我在条件中使用whereDate((来截断日期时间字段。现在我想使用 DB::raw
选择一个日期时间字段 (eodate( 如果可能的话。有什么帮助吗?
您必须
在where
条件之前使用DB::raw
。您的查询应如下所示
$vrec=DB::table('st_sales_live_bk')->select(DB::raw('trunc(EODATE)'))
->where('brandid', $brandid)
->where('branchid', $branchid)
->where('module_id', 1)
->get();
return $vrec;