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 trialXavier Swehla
2,852 Pointswhy does the following code not work?
SELECT COUNT(*) AS shipped_yesterday FROM orders WHERE status = "shipped" AND ordered_on = DATE("now, -1");
TIA
Steven Parker
231,271 PointsGotta start somewhere! Enjoy the process and happy coding!
1 Answer
Steven Parker
231,271 PointsI don't think you want those quotes around both arguments to DATE
.
And the second argument needs both an amount and a time unit. So you probably want: DATE("now", "-1 day")
.
Xavier Swehla
2,852 Pointsnope it still doesn't work, idk why :(
Xavier Swehla
2,852 Pointsim new to sql (obviously) but i tried everything that i know for a good 15 minutes before making this post
Steven Parker
231,271 PointsI updated my answer to include the time unit.
Xavier Swehla
2,852 PointsXavier Swehla
2,852 Pointsthx so much for your help, rip imma noob XD