在sql中如何比较时间
在sql中怎么比较时间SQL codeselect A.UserID,C.UserName,A.Reason,A.DesgoTime,A.DesBackTime,A.AppGoTim
在sql中怎么比较时间
SQL codeselect A.UserID, C.UserName, A.Reason, A.DesgoTime, A.DesBackTime, A.AppGoTime, A.AppBackTime, A.LeaveDays from PersonOutInfo Ajoin UserInfo C on A.UserID=C.UserIDright join OrganInfo B on A.OrganID=B.OrganIDwhere B.OrganID=00000002and 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'