[求助]查询本周开户怎么写代码
我想查询本周开户的用户资料,请问代码应该怎么写,我是这样写的,但是查询不到:
select * from cardInfo where openDate in (convert (datetime,datepart(wk,getdate())))
begin tran
create table cardInfo
(
cardID varchar(19),
curType varchar(10),
savingType varchar(10),
openDate datetime
)
insert into cardInfo
select
'1010 3576 1212 1134','RMB','定期','2006/5/13'
union
select
'1010 3576 1234 5555','RMB','定期','2006/6/1'
union
select
'1010 3576 1234 5678','RMB','活期','2006/5/13'
union
select
'1010 3576 1234 8888','RMB','活期','2005/5/23'
select * from cardInfo
select *
from cardInfo
where
datepart(wk,openDate)=datepart(wk,getdate())
and
datepart(yy,openDate)=datepart(yy,getdate())
rollback tran
[此贴子已经被作者于2006-6-1 23:27:07编辑过]