LMSouq
general-dev Open

How to select date from datetime column?

MY
mysqllearner
1 month ago
3 views
Problem Description
I have a column of type "datetime" with values like 2009-10-20 10:00:00 I would like to extract date from datetime and write a query like: SELECT * FROM data WHERE datetime = '2009-10-20' ORDER BY datetime DESC Is the following the best way to do it? SELECT * FROM data WHERE datetime BETWEEN('2009-10-20 00:00:00' AND '2009-10-20 23:59:59') ORDER BY datetime DESC This however returns an empty resultset. Any suggestions?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base