Sean Flanagan33,224 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 GrantPro 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.