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! While you're at it, check out some resources Treehouse students have shared here.

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

Databases

Samuel Corrado
Samuel Corrado
1,256 Points

todays report, ecommerce objective

Im having a lot of trouble with this question:

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.

My incorrect answer was:

SELECT status, COUNT(*) AS shipped_today WHERE status = "placed" AND ordered_on = DATE("now");

please and thank you

3 Answers

Chris Jones
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Chris Jones
Java Web Development Techdegree Graduate 23,933 Points

Hey Samuel!

The question says "orders that have the status of shipped today", but you have WHERE status = "placed". Should the status be shipped? Also, should you have single quotes around "placed", like below?

WHERE status = 'placed'

Let me know if that helps!

Lindon Skerritt
Lindon Skerritt
1,188 Points

select count(*) as "Shipped_today" from orders where status = "shipped" and ordered_on = date("now")