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)

 

 

--

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.