我有一组没有时分秒的日期
我想在 whereIn
条件中将此数组用于 datetime
列以及单个 userId
检查。问题是如何使用 LIKE
运算符使我的结果包含与我的日期匹配的所有行?
这是我的日期:
array:2 [
0 => "2030-02-06"
1 => "2019-02-06"
]
这是我的查询,我想获取所有结果然后更新它们:
Point::whereIn("end_time",$dates)
->where("user_id","=",$user->user_id)
->update(['is_in_chart'=>1]);
最佳答案
您可以使用 DB::raw
和 DATE()
Point::whereIn(DB::raw("DATE(end_time)"),$dates)
->where("user_id","=",$user->user_id)
->update(['is_in_chart'=>1]);
关于mysql - 其中whereDate在 Eloquent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54977402/