Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Vergleichen von Daten in MySQL, wobei der Zeitteil eines DateTime-Felds ignoriert wird

Sie könnten den DATE Funktion:

SELECT col1, col2, ..., coln
FROM order_table
WHERE date(order_date) = '2012-05-03'

Dies ist jedoch effizienter, wenn Ihre Tabelle groß ist und Sie einen Index zum order date haben :

SELECT col1, col2, ..., coln
FROM order_table
WHERE order_date >= '2012-05-03'
AND order_date < '2012-05-04'