Re: [SQL] abusing an aggregate funct

From: Thomas Good <tomg(at)admin(dot)nrnet(dot)org>
To: Marc Howard Zuckman <marc(at)fallon(dot)classyad(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] abusing an aggregate funct
Date: 1998-11-15 15:08:40
Message-ID: Pine.LNX.3.96.981115100641.8700A-100000@admin.nrnet.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sat, 14 Nov 1998, Marc Howard Zuckman wrote:

> Use a sequence to generate rec_num. See man create_sequence.

Got it.
Thanks Marc!

> You can then use curval('sequence_name') to get the last
> sequence number generated, or if you are performing an insert:
> insert into crtrd1 (p_key,otherdata) values (nextval('sequence_name',moredata);
>
> You could also create the table using nextval as the default
> value of p_key. You may wish to create a unique_index on
> p_key, but nextval is guaranteed not to generate duplicates
> unless you allow it to rollover.
>
>
>
>
>
> Marc Zuckman
> marc(at)fallon(dot)classyad(dot)com
>
> _\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> _ Visit The Home and Condo MarketPlace _
> _ http://www.ClassyAd.com _
> _ _
> _ FREE basic property listings/advertisements and searches. _
> _ _
> _ Try our premium, yet inexpensive services for a real _
> _ selling or buying edge! _
> _\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
>

---------- Sisters of Charity Medical Center ----------
Department of Psychiatry
----
Thomas Good <tomg(at)q8(dot)nrnet(dot)org>
Coordinator, North Richmond C.M.H.C. Information Systems
75 Vanderbilt Ave, Quarters 8 Phone: 718-354-5528
Staten Island, NY 10304 Fax: 718-354-5056

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Marc Howard Zuckman 1998-11-15 16:04:26 Re: [SQL] abusing an aggregate funct
Previous Message Herouth Maoz 1998-11-15 15:02:55 Re: [SQL] Incrimenting question