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 trialLyola Rowe
3,806 PointsNeed help with this query
I'm typing in this query - what am I doing wrong?
select count(*) from orders where status="shipped" and ordered_on=date(now) as shipped_today;
2 Answers
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsYou have to put the 'now' in quotes and place 'as shipped_today' in between count(*) and from.
Joseph Yhu
PHP Development Techdegree Graduate 48,637 PointsReplace the semicolon in your date function with a comma.
Lyola Rowe
3,806 PointsLyola Rowe
3,806 PointsThank you! What about this challenge? 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 yesterday and have the status of 'shipped'. Alias it to ordered_yesterday_and_shipped.
I'm posting this and it's not working: select count(*) as ordered_yesterday_and_shipped from orders where status="shipped" and ordered_on=date("now"; "-1 day");