Sign up ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I am an amateur.

I am trying the following

select * from [dbo].[AccessFeeDetail]
where LastLoginDate >= '10/15/2012 00:00:00.000', jobname not like 'Uptest_%'

I am making a mistake on where clause. Can you correct me

"LastLoginDate" and "JobName" are Fields in the same table.


share|improve this question

1 Answer 1

up vote 6 down vote accepted

The comma , is not a valid logical operator. Try using AND or OR, depending on what you need, rows that match either one or both criteria (use OR) or only the rows that match both criteria (use AND).

You should also avoid writing dates with ambiguous formats, like the '10/15/2012 00:00:00.000'. Use either 2012-10-15T00:00:00.000 or '20121015 00:00:00.000' format. You can read Aaron Bertrand's blog for more details about dates and range queries: Bad habits to kick : mis-handling date / range queries. In this particular query and because the date has no time part, you can also use the shorter '20121015':

select * 
from [dbo].[AccessFeeDetail]
where LastLoginDate >= '20121015'
      jobname not like 'Uptest_%' ;
share|improve this answer
Perfect... Thank you.. I was so close and needed to add And. – Rizwan Nov 15 '12 at 15:45
Appreciate fast response – Rizwan Nov 15 '12 at 15:46
If you are putting this into production, get rid of that SELECT *. – jgardner04 Nov 15 '12 at 21:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.