Advertisement
Guest User

View tvshowcounts

a guest
Jan 28th, 2015
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.50 KB | None | 0 0
  1. 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