I would like to know how do I query a database to select all records that don’t fall in a particular day. In this case, I want to select all records that are not wednesdays. My date column in MySQL database is “Date” ex. 2012-09-10.
My “pseudo” select is as follows:
SELECT * FROM mytable WHERE date NOT IN(SELECT* FROM mytable WHERE date = WED)
Does anyone know the correct syntax?
What you want is the WEEKDAY() function.
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_weekday
2 = Wednesday