eliteangler — 2010-02-11T15:08:23-05:00 — #1
Hopefully this is an elementary question that I just can't seem to get my head around. I'm far from being a master in queries. Can I query for records using the name of the day of the week in my date field? In other words find all the records that have a Saturday as the date when my date field is saving the date in this format (2004-07-10)? Didn't know how I could use dayname() in my query to get the results, if at all. I don't want to display the day name ("Saturday"), I would like to use it in my query. Kind of like this, which I know is not valid
SELECT var1, var2, date FROM table a WHERE dayname(date)=Saturday
Any help is appreciated
r937 — 2010-02-11T17:00:14-05:00 — #2
WHERE DAYOFWEEK(datecolumn) = 7
eliteangler — 2010-02-11T21:15:34-05:00 — #3
worked like a champ. I knew I was asking a dumb question. Don't know why I didn't think of doing it that way, but thanks for making me feel like an idiot. Sometimes, you just need to be reminded!
r937 — 2010-02-11T21:47:01-05:00 — #4
oh come on, you weren't an idiot, you were on the right track
this would work too --
WHERE DAYNAME(datecolumn) = 'Saturday'
it's just more typing