rhodesy22 Posted January 21, 2007 Share Posted January 21, 2007 I have the following query[code]SELECT showTable.showID,showTable.name,timeTable.season,timeTable.episodeID,timeTable.episodeTitle,timeTable.episode,UNIX_TIMESTAMP(timeTable.episodeDate) as date FROM shows showTable LEFT JOIN tvtimes timeTable ON showTable.showID=timeTable.showID WHERE ( showTable.showID='1') AND timeTable.episodeDate<NOW() ORDER BY showTable.name,timeTable.episodeDate DESC[/code][code]WHERE ( showTable.showID='1') [/code] would normally be lots of showID's with OR's inbetweenIn the timeTable is about 8000 records of all episodes and when they were airedTHe showTable has a list of ShowsThe above query does what I want it to do (which is to return all previously Aired episodes) however it's very slow - instead of returning ALL previously Aired episodes I only want it to return the last 1 or last 3 or last 6 or 12 and so on...I have tried splitting it into two seperate queries but still no luckHope you can help.Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Nhoj Posted January 21, 2007 Share Posted January 21, 2007 Add[code=php:0]LIMIT 6[/code] or [code=php:0]LIMIT 12[/code]At the end of your long query. Quote Link to comment Share on other sites More sharing options...
rhodesy22 Posted January 21, 2007 Author Share Posted January 21, 2007 That won't work because im wanting only 3 or 6 or 12 rows from all the shows in the WHERE ( showTable.showID='1' OR showTable.showID='2' etc etc Quote Link to comment Share on other sites More sharing options...
fenway Posted January 22, 2007 Share Posted January 22, 2007 [quote author=rhodesy22 link=topic=123392.msg509932#msg509932 date=1169408476]That won't work because im wanting only 3 or 6 or 12 rows from all the shows in the WHERE ( showTable.showID='1' OR showTable.showID='2' etc etc[/quote]What? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.