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 trialNicholas DeVries
4,366 PointsReporting with SQL help
Why is this not right ?
2 Answers
Andrew Winkler
37,739 PointsYou didn't alias the table 'AS shipped_yesterday' nor did you have correct context in 'DATE('now', '-1 days');'
I went back and tested this myself:
--incorrect code
SELECT COUNT(*)
FROM orders WHERE status = "shipped" AND ordered_on = DATE('now', '-1 day');
--correct code
SELECT COUNT(*) AS shipped_yesterday
FROM orders WHERE status = "shipped" AND ordered_on = DATE('now', '-1 days');
Nicholas DeVries
4,366 PointsThank you !