• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 496
  • Last Modified:

MYSQL select records for a specific day from date column

I have a table in mysql with a day column with type DATE.
I need to select all the records for Monday. Is there any way to filter records by putting
the day condition on date column. e.g.

select * from mytable where day = SomeTranslationFunction('Sunday');


select * from mytable where day = SomeTranslationFunction('Sunday');

Open in new window

0
SimonHowald
Asked:
SimonHowald
1 Solution
 
lwadwellCommented:
Hi SimonHowald,

try ...

select * from mytable where dayofweek(day) = 2;

the dayofweek() function returns the day of the week as 1 = Sunday, 2 = Monday ...

You could also use the dayname() function.


lwadwell
0
 
khr2003Commented:
hi
I do not think there is a problem in adding a function to the query, however you must take into account the output of that function. So you have to be aware of the function you are using.

regards
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now