沃梦达 / 编程问答 / php问题 / 正文

whereBetween Dates in laravel 4 eloquent

whereBetween Dates in laravel 4 eloquent(whereBetween Dates in laravel 4 eloquent)

本文介绍了whereBetween Dates in laravel 4 eloquent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个这样的查询

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

Now how I can convert this query in laravel 4. I use 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();

也许你可以试试这个

这篇关于whereBetween Dates in laravel 4 eloquent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:whereBetween Dates in laravel 4 eloquent

基础教程推荐