Robbiez Posted March 20, 2021 Share Posted March 20, 2021 HI Can anyone help with a statement to select all rows from a table where the value of a column is earlier than today's date. The date is stored as(for example) Monday 1 March %W %e %M I was hoping something like this would work: SELECTÂ * FROM `table` WHERE DATE_FORMAT(dispatchdate, '%W %e %M') < NOW()-INTERVAL 1 DAY Thanks Quote Link to comment Share on other sites More sharing options...
requinix Posted March 20, 2021 Share Posted March 20, 2021 16 minutes ago, Robbiez said: The date is stored as(for example) Monday 1 March Well there's your first problem. Store it as an actual DATE and format it when you display the value to the user, then working with it in your SQL will be much easier - and faster, more efficient, using fewer system resources, etc. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.