Stephan Huber: erste zahl abrufen, die noch nicht vergeben ist

Beitrag lesen

Hallo Mabu,

und ein "order by" habe ich dummerweise auch vergessen, tsss...:

SELECT tabelle1.id+1 as nextid FROM tabelle as tabelle1 LEFT JOIN tabelle as tabelle2 ON tabelle1.id+1 = tabelle2.id WHERE tabelle2.id IS NULL ORDER BY nextid LIMIT 1

Viele Grüße
Stephan