mysql 日期介于_mysql查询找到时间介于from和to之间

3 个答案: 答案 0 :(得分:1) 您使用的是值而不是列名 您可以使用以下查询。您可以根据需要更改价值。 根据您的需要首先更改时间值。 int[] to

3 个答案:

答案 0 :(得分:1)

您使用的是值而不是列名

您可以使用以下查询。您可以根据需要更改价值。

根据您的需要首先更改时间值。

int[] to = {R.id.student_view};

SimpleCursorAdapter mCurAdapter = new SimpleCursorAdapter(getContext(),R.layout.list_template, mCursor, from, to,0);的第一个选项

Where

第二个选项是SELECT * FROM `table` WHERE from_time >= '00:00:00' and to_time <= '23:59:59'

between

答案 1 :(得分:0)

对于超过午夜的to_times,您可以添加24小时然后进行测试。例如

drop table if exists t;

create table t(from_time time, to_time time);

insert into t values

('18:00:00','20:00:00'),

('18:00:00','01:00:00'),

('16:00:00','18:00:00');

select from_time,to_time,

case when '19:00:00' between

from_time and

if(to_time < from_time,

addtime(to_