在sql中怎么比较时间
SQL code
select A.UserID,
C.UserName,
A.Reason,
A.DesgoTime,
A.DesBackTime,
A.AppGoTime,
A.AppBackTime,
A.LeaveDays from PersonOutInfo A
join UserInfo C on A.UserID=C.UserID
right join OrganInfo B on A.OrganID=B.OrganID
where B.OrganID=00000002
and A.DesgoTime>=2012-07-01 and A.DesBackTime>=2012-06-22
为什么这个时间比较没有用?
------解决方案--------------------
select A.UserID,
C.UserName,
A.Reason,
A.DesgoTime,
A.DesBackTime,
A.AppGoTime,
A.AppBackTime,
A.LeaveDays from PersonOutInfo A
join UserInfo C on A.UserID=C.UserID
right join OrganInfo B on A.OrganID=B.OrganID
where B.OrganID='00000002'
and A.DesgoTime>='2012-07-01' and A.DesBackTime>='2012-06-22'