Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Sean Flanagan33,232 Points
Hi. How's my solution for this challenge?
SELECT * FROM loans WHERE returned_on > return_by;
I think we want loans with a return_by date which is in the past and with no returned_on date (book hasn't been returned.) This seemed to work:
SELECT * FROM loans WHERE return_by < DATE("now") AND returned_on IS NULL;
Yassin Chiguer5,228 Points
The following query worked for me. Checks your current date (now) to yesterday's date (-1 day) for the return_by value. That's my understanding from the tutorial.
select * from loans where return_by = DATE("now", "-1 day")
Marcus GrantCourses Plus Student 2,546 Points
Since I noticed that the dayys in this challenge are dynamic, I came up with the following which works:
SELECT * FROM loans WHERE return_by < DATE("now");
Since the book might be due to returned today, it won't count as it's not overdue. However, if the return date is null and is any day before today I will get the correct list of overdue books.