Hout, Eric van den
Wed, 31 Oct 2001 10:26:42 +0100
Thnax, this worked. However I still am not able to use it as a auto-number
function. (remember I'm a newby :-) ). When someone enters a new db record
in a form, I want to automatically raise the Primary key by 1. Where can I
do this addition?
something? I'm hoping there's a more intelligent way to do this.
> -----Oorspronkelijk bericht-----
> Van: Matthew T. Kromer [mailto:email@example.com]
> Verzonden: maandag 29 oktober 2001 13:30
> Aan: Hout, Eric van den
> CC: 'firstname.lastname@example.org'
> Onderwerp: Re: [Zope-DB] max(<fieldname>)
> On Monday, October 29, 2001, at 06:41 AM, Hout, Eric van den wrote:
> > Hi,
> > Can anyone tell me why this:
> > select nw_id from nieuws
> > does work and this:
> > select max(nw_id) from nieuws
> > does not?
> > What I am trying to do on a Gadfly DB is to make a primary
> key "auto"
> > incremental.
> > Anyone knows some info on how to achieve this? The book and
> the gadfly
> > docs
> > trell how to create a unique index, but I can't find out how to use
> > this to
> > "auto create" my Primary key.
> > Help?
> Hi Eric,
> I'm not sure that Gadfly supports any kind of automatic unique key
> generation BUT, I can suggest why your MAX(nw_id) fails. When you
> select something from a Database Adapter, zope tries to name
> it the same
> way the result comes back -- in this case as MAX(nw_id) --
> so instead,
> if you
> select MAX(nw_id) as nw_id from nieuws
> it should work...