Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
What is wrong with my code?
"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 have the status of shipped today. Alias it to shipped_today"
I entered this but I do not understand what is wrong
select count(*) from orders where status = "shipped" and date("now");
Steven Parker227,167 Points
You forgot the alias, and your date comparison is incomplete.
It looks like junescano got closer, but you wouldn't use "
IS" to compare dates (just a regular "
Also, if you're looking for "today" you wouldn't add that extra argument to subtract a day. That would be if they had asked for "yesterday" (which I think they do in a different challenge).
In future, always include a link to the course page to facilitate the most accurate answers.
SELECT COUNT (*) AS shipped_today FROM orders WHERE status = "shipped" AND ordered_on DATE("now");