views:

143

answers:

3

I'm trying to split a table in two views depending on whether the field "Date" is today or not. I have tried using WHERE DATEVALUE(table.Date)=DATE(), but I get an error at saving saying that the last ) has wrong syntax. I tried adding a group by, but apparently everything after the ) gives me the same message about wrong syntax) Am I typing something wrong? Can I fix this? Is there maybe another way to do this?

+1  A: 

You should try WHERE table.date = DATE( -your date- ). For instance:

WHERE table.date = DATE('1977-10-20') ;
jeje
+1  A: 

your function usage is wrong:

WHERE DATE(table.Date)=CURRENT_DATE
longneck
+1  A: 

The condition you're looking for is:

table.`Date` = CURDATE()

if you column is of DATE type or

DATE(table.`Date`) = CURDATE()

if it's of DATETIME type

ChssPly76