CyberArmy University | Open Source Institute | CyberArmy Intelligence & Security | CyberArmy Services & Projects

RE: SQL problem


[Replies] [Reply] [View by Thread] [Help]
[Back To Programming]

Posted by Ker sefo On 2008-08-18 12:02:45
In Reply to SQL problem Posted by Gamma LtKer MDalby On 2008-08-18 09:53:18

Ker
Ker sefo


Maybe you could use the language you know to extract the data to a recordset or table and order it by ID ASC

Then loop through your recordset and make an INSERT if record[i+1] != record[i] + 1

On 2008-08-18 09:53:18, MDalby wrote
>I have a database with the columns `id` and `data` the `id` column contains different numbers with values between 1 and 999 .
>
>e.g. SELECT * FROM database would return
>
>-----------
>|ID ||Data|
>-----------
>|2 ||dret|
>|4 ||asdf|
>|7 ||asdd|
>-----------
>
>What i want to do fill in the gaps in `data` so that the column has all the numbers from 1 to 999 WITHOUT going over the ones that are (I need to keep the data intact)
>
>Desired Result..
>SELECT * FROM database
>
>-----------
>|ID ||Data|
>-----------
>|2 ||dret|
>|3 || |
>|4 ||asdf|
>|5 || |
>|6 || |
>|7 ||asdd|
>|8 || |
>|8 || |
>|10 || |
>-----------
>etc...
>
>Does anyone have a simple way to do this, I've been up since the early hours and my brain has switched off :-(


Replies:


Guest:
Subject:
Message:
Signature:
Optional Image Link:
http://

CyberArmy::Forum v0.6
Generated In 0.01778 seconds


About Us | Privacy Policy | Mission Statement | Help