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 Reporting with SQL Date and Time Functions Calculating Dates

Your code challenge appears to have a broken Javascript file in it? (or at least in this instance of the virtual machine

The site is unable to process my code attempt at the solution, here's what I intended to submit.

select count(id) as ordered_yesterday_and_shipped from orders where ordered_on = date("now", - 1 day) and status = "shipped";

Looking in the dev console, it looks like a JS error "Uncaught SyntaxError: Unexpected end of input (at VM693 foundation-A187849-72ad-44c6-83bc-3d4f458b85e71.min.js:392:5)"

1 Answer

Steven Parker
Steven Parker
229,920 Points

Attempting to debug the challenge engine code is likely to cause more confusion than help.   :see_no_evil:

The issue here is with the syntax of the solution. The modifier for the date function must be a string, so the value needs to be enclosed in quotes. Also, there should not be any space between a sign and the number it applies to. The space causes it to be interpreted as an operator instead of just a sign.

Thanks, I did eventually get it to accept the answer. Enclosing the modifier in quotes probably helped 😬

I guess what made me think that it was a deeper error was that it wasn't even processing my solution to tell me whether it was incorrect. It would just hang and tell me to reload the page and "Don't worry your code is safe" then would delete my code after reloading, and continue to not work.

Steven Parker
Steven Parker
229,920 Points

When I ran it, I got "Bummer: There's something wrong with your SQL statement. Please review your code and try again."

That "reload" issue is one I've seen from time to time, and it generally seems to be a temporary server issue that goes away after a while.