Search code examples
sqlsql-like

sql like to find orders in specific date


I have a table of orders. the column dateordered represents the date in which an order occurred. That column is a datetime. Looking like: YYYY-MM-DD.

I have the following query.

select * from orders_ where dateordered like '08%' -- for orders which occurred in augus

but I'm not getting any results, when I should.

What am I doing wrong?


Solution

  • As it's a date calculation, you can say:

    select * from orders_ where month(dateordered) = 8