I have a database that is pre-populated with sequential part numbers.
As people reserve the parts I update a flag to show the # is no longer
available. Now they want the ability to take out a block of "x"
number of sequential part numbers - say for example 5.
If my database had the following numbers available:
101
104
105
110
111
112
113
114
It should return 110 thru 114 and then I would write an update query
to change the flags to 1 (checked out).
I have only been able to return the first "x" number of records - have
not been able to make sure they are stepped sequentially - with the
following:
SELECT ID_ITEM From PARTNO_CHKOUT_S PECIAL M Where (Select Count(*)
FROM PARTNO_CHKOUT_S PECIAL N
WHERE N.ID_ITEM <= M.ID_ITEM) >= 0 AND TYPE_REC=1 AND
FLAG_CHECKED_OU T=0 {maxrows 5}
The above would return 101, 104, 105, 110, 111
I tried using an (N.ID_ITEM+1)-M.ID_ITEM=0 to try stepping and get
errors, probably incorrect syntax. Can I do this in an SQL statement?
As people reserve the parts I update a flag to show the # is no longer
available. Now they want the ability to take out a block of "x"
number of sequential part numbers - say for example 5.
If my database had the following numbers available:
101
104
105
110
111
112
113
114
It should return 110 thru 114 and then I would write an update query
to change the flags to 1 (checked out).
I have only been able to return the first "x" number of records - have
not been able to make sure they are stepped sequentially - with the
following:
SELECT ID_ITEM From PARTNO_CHKOUT_S PECIAL M Where (Select Count(*)
FROM PARTNO_CHKOUT_S PECIAL N
WHERE N.ID_ITEM <= M.ID_ITEM) >= 0 AND TYPE_REC=1 AND
FLAG_CHECKED_OU T=0 {maxrows 5}
The above would return 101, 104, 105, 110, 111
I tried using an (N.ID_ITEM+1)-M.ID_ITEM=0 to try stepping and get
errors, probably incorrect syntax. Can I do this in an SQL statement?
Comment