linq to sql 查询两者之间的语句怎么写,例如7月份到8月份的数据

2024-12-03 12:30:50
推荐回答(2个)
回答(1):

form t in table(表)
where t.datetime(字段名)>=[时间] and t.datetime<=[时间]
select t;

回答(2):

SQL:
(1) select * from tablename where datefield between to_date('2011-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('2011-09-01 00:00:00','yyyy-mm-dd hh24:mi:ss');
(2) select * from tablename where to_char(datefield, 'mm') in ('07', '08');