Re: find free number in col

From: Jens Puruckherr (puru@elbvilla.de)
Date: Tue Oct 12 1999 - 18:26:37 EST


Hi,
> well when you delete you can store free number b in a list and sort it,
> next delete you do the same next insert you take the biggest form the
> list,

Hmm, that would work...

>if the list is empty, then get the next number in SEQuense.
>

These sequences are not that, what I need. (and...I don't inderstand it
-( )In reality it's a little bit more diffcult, than I described in my last
posting: In a table there are two or tree cols with int-numbers. All these
cols are together an unique index .
That looks like this:

col1 col2 col3
1 1 1
1 1 2
1 2 5
2 1 1
2 1 7
2 2 1
3 1 1
.......

An INSERT happens in that way:

INSERT into tab values(new(col3)...) WHERE col1=1 AND col2=1

the new(col3) must known through an other statment before ---but how??
And: col1 and col2 are relations to other tables an important for the
database and have a really meaning!

Thanks!

> > Hi!
> >
> > It's more a problem in maths but in msql, but I don't know who can give
> > better answers then programmers ;-)
> >
> > following task:
> > In a col of a msql-table there are in each row an unique number
> > a,b,c....(int)
> > The next INSERT should find "itself" the next free number d=c+1
> > the overnext INSERT should find the number e=d+1
> >
> > a DELETE deletes the row with the number b
> > The next INSERT should now get the free number b
> > the overnext INSERT get's the number f=e+1
> >
> > How can I get the biggets free number and how can I get the "holes" in
the
> > numberlist??
> > in Lite??
> >
> > Thanks!!
> >
> >
> >
> >
> > Mit freundlichen Grüßen
> >
> >
> > Jens Puruckherr
> >
> > EDV-Manager
> > Elbvilla facility Service GmbH
> > Scharfenberger Straße 2
> > 01139 Dresden
> > -------------------------------------------------------
> > Tel. 03528/446372 mail:puru@elbvilla.de
> > Fax. 0351/8588571 http://www.wohnungsmarkt-dresden.de
> >
>
> -------------------------------------------------------------------------
> > To unsubscribe, go to http://www.Hughes.com.au/extras/email/
> >
>

-------------------------------------------------------------------------
To unsubscribe, go to http://www.Hughes.com.au/extras/email/



This archive was generated by hypermail 2b30 : Mon Mar 04 2002 - 09:03:51 EST