Re: find free number in col

From: Ing. Juan Carlos Fernandez-B (juan@linux.form-net.com)
Date: Tue Oct 12 1999 - 18:00:07 EST


Hello Jens,
I still think you could use SEQ's, they are not that complicated. they are
numbers in sequencial order (1,2,3,4... or 1,3,5,7,9,)you decide when they
increment and by how much (read the manual, I think it is very clear)
sdo you couyld have 3 diferent SEQ's, actually I am not sure is you can do
this in the same table, but if not you could store the numbers some there
else (in a file, or in another table) and incrementhem at will.
may be this is not the most pretty solution, but could work (i think =-)

cheers
Juan Carlos

>
> 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/
>

-------------------------------------------------------------------------
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