Click here to Skip to main content
15,886,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
MSIL
OfficialEmail                  EmployeeName       LoginTime        Remark
mohd.wasif@apvtechnologies.com  Mohd Wasif  2010-01-14 00:00:00.000 Makar Sakranti
mohd.wasif@apvtechnologies.com  Mohd Wasif  2011-01-04 00:00:00.000 Paid Leave
mohd.wasif@apvtechnologies.com  Mohd Wasif  2011-01-05 00:00:00.000 Paid Leave
mohd.wasif@apvtechnologies.com  Mohd Wasif  2011-01-13 00:00:00.000 Paid Leave
mohd.wasif@apvtechnologies.com  Mohd Wasif  2011-01-14 00:00:00.000 Paid Leave
mohd.wasif@apvtechnologies.com  Mohd Wasif  2011-01-17 00:00:00.000 LWP
mohd.wasif@apvtechnologies.com  Mohd Wasif  2011-01-18 00:00:00.000 LWP
mohd.wasif@apvtechnologies.com  Mohd Wasif  2010-12-15 00:00:00.000 Paid Leave
mohd.wasif@apvtechnologies.com  Mohd Wasif  2010-12-16 00:00:00.000 Paid Leave



First column is Official Email,Employee Name, Login time,Remarks

select * from Attendance_Master where OffEmail='mohd.wasif@apvtechnologies.com'
and LoginTime=getdate()
and Remark like 'LWP'
or Remark like 'Paid Leave'


there is no record in present date still it's showing
Records with 'paid leave'

Please sort out my problem
Thanking You
Mohammad Wasif
Posted
Updated 10-Jan-11 23:56pm
v2
Comments
Mohd Wasif 11-Jan-11 6:04am    
Problem Solved Thanks alot
Estys 11-Jan-11 6:16am    
Thank you. If you mark the question "Answered" all people can see that they don't need to bother anymore.

Operator precedence :

and (Remark like 'LWP' or Remark like 'Paid Leave')

Is that what you intend?

Cheers
 
Share this answer
 
Comments
Mohd Wasif 11-Jan-11 6:04am    
Thanks For Solving my problem
I think problem in your query is here

and LoginTime=getdate()

Because GetDate() will return you date with current time also and I think comparison will be mismatched always as you will not have record which will be same at second you're comparing.

I think compare only date rather then date with time

There are many options available Like

CONVERT(VARCHAR(10), @pInputDate, 111) and then compare.

I think this will solve your problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900