如下:
select card_type,count(*) from tb_AssociatorCard where (open_date between '2008-4-1' and '2008-4-1')and deptid=10 and state=N'已分配' group by card_type
为什么查不到数据?请帮忙!
select card_type,count(*) from tb_AssociatorCard where (open_date between '2008-4-1' and '2008-4-1')and deptid=10 and state=N'已分配' group by card_type
为什么查不到数据?请帮忙!
select card_type,count(*) from tb_AssociatorCard where (convert(varchar(10),open_date,120) between '2008-04-30' and '2008-04-01') and deptid=10 and state=N'已分配' group by card_type select card_type,count(*) from tb_AssociatorCard where convert(varchar(10),open_date,120) = '2008-04-01' and deptid=10 and state=N'已分配' group by card_type
select * from tb_Associator_Message where datediff(dd,getdate(),Birthday)=10
我的数据类型是:datetime(1944-1-10 0:00:00)
select card_type,count(*) from tb_AssociatorCard where (open_date between '2008-4-1' and '2008-4-1')and deptid=10 and state=N'已分配' group by card_type
类似于:只查询2008-04-01的数据select card_type,count(*) from tb_AssociatorCard where (open_date='2008-4-1')and deptid=10 and state=N'已分配' group by card_type
select * from tb_Associator_Message where datediff(dd,getdate(),convert(varchar(10),Birthday,120))=10
--谁的生日在今天之后十天?(答:2008-05-15)
select * from tb_Associator_Message where datediff(dd,Birthday,getdate())=10
可是有一个'1980-5-9'就是找不到..select * from tb_Associator_Message where datediff(dd,convert(varchar(10),Birthday,120),getdate())=4
where (cast(open_date as datetime) between '2008-4-1 00:00:00' and '2008-4-1 23:59:59')
and deptid=10 and state=N'已分配'
group by card_type