My current query:
SELECT Series.*, Episodes.* FROM Series, Episodes
WHERE EpisodeAirDate > '.time().' AND Episodes.SeriesKey = Series.SerieID
GROUP BY Series.SerieTitle ORDER BY Episodes.EpisodeAirDate;
I want to retrieve the information from Episodes where Episodes.EpisodeAirDate is the closest to the current time (time()). With this I just get the last episode in the database.
I’ve tried with
SELECT Series.*, Episodes.*, MIN(Episodes.EpisodeAirDate) AS EpisodeAirDate FROM Series, Episodes
WHERE EpisodeAirDate > '.time().' AND Episodes.SeriesKey = Series.SerieID
GROUP BY Series.SerieTitle ORDER BY EpisodeAirDate;
which kind of works, but Episode.EpisodeTitle etc. does not correspond with the timestamp row.
Here I’m using the MIN()-query (http://grab.by/8UNY). I wasn’t allowed to post an image, so perhaps a link will suffice 🙂
As you can see, the SerieTitle and “Time until” is correct, but the EpisodeTitle, EpNo and SeasonNo is that of the first query.
It’s hard to explain, really. I hope you make sense of this! 🙂
Please try this:
Edit: Added the ORDER BY clause.