添加whereBetween子句不会返回预期结果集

时间:2019-03-04 15:49:44

标签: laravel sqlite laravel-5 eloquent

示例数据集

table1

如您所见,有两种table2类型,因此group by应该返回两行。当前,当我添加select t2out.name out_name, t2in.name in_name, t1.other_fields from table1 t1 join table2 t2out on t2out.id=t1.out_path_id join table2 t2in on t2in.id=t1.in_path_id 子句

时,它仅返回第一个结果

我正在使用locationcar,试图在某个时间范围内返回某些结果。问题是,当我在@BeforeClass public static void setUpClass() { ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger("org.apache.http"); root.setLevel(ch.qos.logback.classic.Level.INFO); //... } 列上添加id,created_at, status, category, c_sub_category 1, 2019-01-02 16:36:06, closed, Issue, Team 1 2, 2019-01-03 18:36:01, closed, Fix, Team 2 子句时,它缺少结果。 c_sub_category的类型为whereBetween

Laravel 5.6SQLite是碳实例

whereBetween

此查询应返回两个结果。我按created_at分组,只有两个created_at,但目前只返回1个结果

DateTime

此查询没有startDate子句,返回两个正确的结果

endDate

我尝试过的其他方法也无法返回正确的结果集

{
    "startDate": {
        "date": "2019-01-01 00:00:00.000000",
        "timezone_type": 3,
        "timezone": "America/Toronto"
    },
    "endDate": {
        "date": "2019-01-06 23:59:59.999999",
        "timezone_type": 3,
        "timezone": "America/Toronto"
    }
}

2 个答案:

答案 0 :(得分:0)

您必须输入长日期格式,而不仅仅是日期

std::vector

答案 1 :(得分:0)

另一个解决方案可能是:

Tickets::where('created_at', '>=','2019-01-01 00:00:00.000000')->where('created_at', '<=','2019-01-06 23:59:59.999999');