草庐IT

php - whereBetween Dates in laravel 4 Eloquent

coder 2023-12-31 原文

我有这样的疑问

SELECT * FROM `sp_price` WHERE (`from_date` between '2014-08-15' and '2014-09-18') || (`to_date` between '2014-08-15' and '2014-09-18')

现在我如何在 laravel 4 中转换这个查询。我使用 Eloquent

最佳答案

DB::table(sp_price)
     ->whereBetween('from_date',array('2014-08-15','2014-08-18'))
     ->orWhereBetween('to_date',array('2014-08-15','2014-08-15'))
     ->get();

也许你可以试试这个

关于php - whereBetween Dates in laravel 4 Eloquent ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26082043/

有关php - whereBetween Dates in laravel 4 Eloquent的更多相关文章

随机推荐