Hi all.
I have a question that I'd like to get some help on.
I have a table with a column (ProjectNumber) that contains something similar to the following:
04910010
04910020
04910030
04910050
04910100
04910110
04910120
04910500
etc...
I would like to find the next available number which is defined as:
1. Order the numbers in ascending sequence
2. start from the lowest number
3. search until you find 2 numbers that are greater than 10 apart from each other
3. return the lower number with 10 added to it.
(I want to keep 10 free numbers in between each project number)
ie. in the list above the next available number should be 04910040.
I can do this using ASP code but I'm wondering how to do this using an SQL query.
I just don't know SQL good enough to write a query for this.
Thanks,
Keith
I have a question that I'd like to get some help on.
I have a table with a column (ProjectNumber) that contains something similar to the following:
04910010
04910020
04910030
04910050
04910100
04910110
04910120
04910500
etc...
I would like to find the next available number which is defined as:
1. Order the numbers in ascending sequence
2. start from the lowest number
3. search until you find 2 numbers that are greater than 10 apart from each other
3. return the lower number with 10 added to it.
(I want to keep 10 free numbers in between each project number)
ie. in the list above the next available number should be 04910040.
I can do this using ASP code but I'm wondering how to do this using an SQL query.
I just don't know SQL good enough to write a query for this.
Thanks,
Keith