aparsons Posted September 24, 2007 Share Posted September 24, 2007 I am writing a web parser for a guy in my spare time, and I'm keeping track of what pages I hit. I'm noticing that my program skips pages for some odd reason, and I'm wondering if there is a query I can use to go back and fill in the blanks. My data set looks like below. And page_index should be sequential. You can see I'm missing pages between 12189 and 12181. Is there anyway I can get a list of the pages I'm missing? So my list should contain: === WHAT I NEED TO FIND ==== 12188 12187 12186 12185 12184 12183 12182 etc === My current data set is this: ==== mysql> select distinct(page_index) from raw_data order by page_index desc LIMIT 30; +------------+ | page_index | +------------+ | 12189 | | 12181 | | 12173 | | 12172 | | 12165 | | 12157 | | 12156 | | 12149 | | 12142 | | 12135 | | 12127 | | 12120 | | 12112 | | 12104 | | 12096 | | 12088 | | 12080 | | 12072 | | 12065 | | 12064 | | 12058 | | 12052 | | 12046 | | 12045 | | 12039 | | 12038 | | 12032 | | 12025 | | 12018 | | 12011 | +------------+ 30 rows in set (0.50 sec) -- Link to comment https://forums.phpfreaks.com/topic/70455-need-help-with-sql-to-compare-missing-data/ Share on other sites More sharing options...
fenway Posted September 24, 2007 Share Posted September 24, 2007 I suggest you use a mutex table to generate the full sequence range, then left join is null. Link to comment https://forums.phpfreaks.com/topic/70455-need-help-with-sql-to-compare-missing-data/#findComment-354261 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.