ORDER BY
我的数据如上。我将传递开始日期和结束日期,以便在日期之间产生数据,如果日期不存在则必须插入空数据(带开始和结束日期的字典为空)。下面列出了“2015-12-02”,“2015-12-16”之间的日期。它必须如下所示。
[
{
start_time: "09:00",
end_date: "2015-12-20",
end_time: "13:55",
start_date: "2015-12-15"
},
{
start_time: "06:07",
end_date: "2015-12-24",
end_time: "08:09",
start_date: "2015-12-22"
},
{
start_time: "09:30",
end_date: "2015-12-01",
end_time: "18:00",
start_date: "2015-12-01"
},
{
start_time: "01:00",
end_date: null,
end_time: "04:00",
start_date: null,
},
{
start_time: "05:00",
end_date: null,
end_time: "08:00",
start_date: null,
}
]
有人可以帮我吗?
答案 0 :(得分:0)
基本上你应该能够在字符串之间进行比较(比较函数是日期比较)。所以我先把它转换成日期 -
SELECT a.vd,
a.vext,
c.evalu
FROM val_tb a
join val_tb d
ON A.va_record_id = d.red
join carin b
ON A.vext = b.source_pos_id
join mapos c
ON b.posd = c.posid
WHERE d.valnum = 100008533
AND d.vd IN ( 1887, 1890 )
AND a.varnum = 1
AND b.sname = 'cat';
现在你可以>< =运算符并迭代你拥有的事件列表。对于每个记录,转换start_date和end_date并检查它们是否填满了您要查找的条件。