Databases Reporting with SQL Date and Time Functions Calculating Dates

Issues with dates, particularly "now"

I am not able to get the query to work. Attempting to count total number of orders from "yesterday". SELECT COUNT(ordered_on) AS ordered_yesterday_and_shipped FROM orders WHERE status = "shipped" AND ordered_on DATE("now", "-1 day");

1 Answer

ivana kantnerova
ivana kantnerova
12,986 Points

i think, just instead COUNT(ordered_on) should be COUNT(*) .. the rest is fine