468,483 Members | 2,680 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,483 developers. It's quick & easy.

Getting error in mssql database query - Date

3
Expand|Select|Wrap|Line Numbers
  1. SELECT COUNT(*) AS NumberOfRows FROM a_poll_votes 
  2. WHERE QUESTION_ID='1' 
  3. AND DATE_SUB(CURDATE(),INTERVAL 0 DAY) <= DATE_FORMAT(DT, '%Y-%m-%d') 
  4. AND IP='111.111.1.1'
  5.  
I think I am making mistake here:

DATE_SUB(CURDATE(),INTERVAL 0 DAY) <= DATE_FORMAT(DT, '%Y-%m-%d')

Can anbody plz help me.

This needs to be in asp and mssql

Thanks
Apr 17 '11 #1
1 1867
code green
1,726 Expert 1GB
Well, you haven't posted the error, but this does look odd
Expand|Select|Wrap|Line Numbers
  1. DATE_SUB(CURDATE(),INTERVAL 0 DAY) <= DATE_FORMAT(DT, '%Y-%m-%d')
This is not how date comparisons are done in SQL.
What filter are you tying to apply here, and is DT a DATETIME data type field. Hopefuly yes
Apr 18 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Manuel | last post: by
9 posts views Thread by Advo | last post: by
1 post views Thread by NareshN | last post: by
3 posts views Thread by tanishka singh | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by kmladenovski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.