-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Thursday 20 November 2003 08:32 schrieben Sie:
> > Is there an easy way to write a select statement that returns me the
> > frist free number or any within the range of 200?
As long as the set of numbers is not too big, the following might work:
CREATE TABLE legal_numbers ( num int );
INSERT INTO into legal_numbers VALUES ( 1 );
... do this with values from 1 to 200;
You can create this table once and for all.
Now the select is rather simple:
SELECT
min(num)
FROM
legal_numbers
WHERE
num not in ( SELECT id FROM other_table )
;
Mit freundlichem Gruß / With kind regards
Holger Klawitter
- --
info@klawitter.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/vIha1Xdt0HKSwgYRAtGbAJ4xR+Naws0vHugt40GH+BJYY/3bAwCdG7t6
2ijqnA8Fm5Z8h4Zhw5H7p3s=
=xsBO
-----END PGP SIGNATURE-----