Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE ALGORITHM=UNDEFINED DEFINER=`xbmc`@`%` VIEW `tvshowcounts` AS SELECT tvshow.idShow AS idShow, MAX(files.lastPlayed) AS lastPlayed, NULLIF(COUNT(episode.c12), 0) AS totalCount, COUNT(files.playCount) AS watchedcount, NULLIF(COUNT(DISTINCT(episode.c12)), 0) AS totalSeasons, MAX(files.dateAdded) AS dateAdded FROM tvshow LEFT JOIN episode ON episode.idShow=tvshow.idShow LEFT JOIN files ON files.idFile=episode.idFile GROUP BY tvshow.idShow ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement