Jump to content

Need help with SQL to compare missing data


aparsons

Recommended Posts

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)

 

 

--

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.