Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 62 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. ## Episodes table
  2. `id` int(11) NOT NULL AUTO_INCREMENT,
  3. `show_id` int(11) DEFAULT NULL,
  4. `title` varchar(255) DEFAULT NULL,
  5. `season` int(11) DEFAULT NULL,
  6. `epnum` int(11) DEFAULT NULL,
  7. `seasonnum` int(11) DEFAULT NULL,
  8. `airdate` varchar(255) DEFAULT NULL,
  9. `link` varchar(255) DEFAULT NULL,
  10. `created_at` datetime DEFAULT NULL,
  11. `updated_at` datetime DEFAULT NULL,
  12. PRIMARY KEY (`id`)
  13.  
  14. ## Shows table
  15. `id` int(11) NOT NULL AUTO_INCREMENT,
  16. `show_id` int(11) DEFAULT NULL,
  17. `title` varchar(255) DEFAULT NULL,
  18. `season` int(11) DEFAULT NULL,
  19. `epnum` int(11) DEFAULT NULL,
  20. `seasonnum` int(11) DEFAULT NULL,
  21. `airdate` varchar(255) DEFAULT NULL,
  22. `link` varchar(255) DEFAULT NULL,
  23. `created_at` datetime DEFAULT NULL,
  24. `updated_at` datetime DEFAULT NULL,
  25.  
  26. ## Finder
  27. @shows = Show.find(:all, :include => :episodes, :conditions => ["episodes.airdate >= ?", Date.today], :order => "episodes.airdate, shows.airtime desc")
  28.  
  29. ## SQL
  30.  
  31. SELECT `shows`.`id` AS t0_r0, `shows`.`showid` AS t0_r1, `shows`.`name` AS t0_r2, `shows`.`started` AS t0_r3, `shows`.`ended` AS t0_r4, `shows`.`airday` AS t0_r5, `shows`.`airtime` AS t0_r6, `shows`.`network` AS t0_r7, `shows`.`showlink` AS t0_r8, `shows`.`created_at` AS t0_r9, `shows`.`updated_at` AS t0_r10, `episodes`.`id` AS t1_r0, `episodes`.`show_id` AS t1_r1, `episodes`.`title` AS t1_r2, `episodes`.`season` AS t1_r3, `episodes`.`epnum` AS t1_r4, `episodes`.`seasonnum` AS t1_r5, `episodes`.`airdate` AS t1_r6, `episodes`.`link` AS t1_r7, `episodes`.`created_at` AS t1_r8, `episodes`.`updated_at` AS t1_r9 FROM `shows` LEFT OUTER JOIN `episodes` ON episodes.show_id = shows.id WHERE (episodes.airdate >= '2009-08-30' OR episodes.id IS NULL) ORDER BY episodes.airdate, shows.airtime desc
  32.  
  33. ## Problem
  34. It only returns episodes in the future, so if a TV program doesn't have any scheduled episodes, it isn't in the list. How can I get around that?
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top