Databases Reporting with SQL Date and Time Functions Today's Report

Caleb Newell
Caleb Newell
5,552 Points

Help with sql date

In an ecommerce database there's an orders table with the columns id, product_id, user_id, address_id, ordered_on, status and cost. Count the total number of orders that were ordered today and have the status of 'shipped'. Alias it to shipped_today.

SELECT COUNT(status) AS shipped_today FROM orders WHERE status = "shipped" AND orderd_on = DATE("now");

It sais there is something wrong with my code, but i do not see anything. Any help is highly appreciated 😁👍

1 Answer

Steven Parker
Steven Parker
201,999 Points

It's just a spelling error, you have "orderd_on" instead of "ordered_on".

Caleb Newell
Caleb Newell
5,552 Points

LOL! didn't see that. 😆😁😂😂😁🤣🤣