I have a web app that collect a simple poll data from my friends. I wanna run a SELECT query to get names based on when the date and month they run put a vote on a poll.
So this is my queries:
SELECT * FROM tbl_votedata
WHERE votersname = "Jack Ryan"
AND targetname = "Bill Murray"
AND votetype = "Friends"
AND MONTH(timestamp) = MONTH(2017-10-02)
AND YEAR(timestamp) = YEAR(2017-10-02)
Date constants should be quoted, something like this:
SELECT * FROM tbl_votedata WHERE votersname = 'Jack Ryan' AND targetname = 'Bill Murray' AND votetype = 'Friends' AND MONTH(timestamp) = MONTH('2017-10-02') AND YEAR(timestamp) = YEAR('2017-10-02')
It was evaluating the
20107 - 10 - 2 expression and used the result as the argument to the function, which was not the correct data type...