[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 490
  • 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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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