> Hi Experts
>
> How I can select Missing Invoice Number from Data. Suppos data have Inv No 1,3,4,5,6,8,9,12,14. and I want to print Missing Inv. No which are 2,7,10,11,13 and so on.
Hi Ahsan -
Do you mean something like this?:
CREATE CURSOR invoices (invno Int)
INSERT INTO invoices VALUES (1)
INSERT INTO invoices VALUES (3)
INSERT INTO invoices VALUES (4)
INSERT INTO invoices VALUES (5)
SELECT invno+1 FROM invoices ;
WHERE ;
invno < (SELECT MAX(invno) FROM invoices) ;
AND ;
invno+1 NOT in (SELECT invno FROM invoices)
hth
-Stefan