Solved

MYSQL select records for a specific day from date column

Posted on 2009-05-09
3
482 Views
Last Modified: 2012-08-13
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
Comment
Question by:SimonHowald
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

Accepted Solution

by:
lwadwell earned 500 total points
ID: 24343090
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
 
LVL 3

Expert Comment

by:khr2003
ID: 24343297
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
Lotus Notes has been used since a very long time as an e-mail client and is very popular because of it's unmatched security. In this article we are going to learn about  RRV Bucket corruption and understand various methods to Fix "RRV Bucket Corrupt…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question