pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Graf <justin@magwerks.com>
To: pgsql-sql@postgresql.org, Gary Chambers <gwchamb@gmail.com>
Subject: Re: Inserting Multiple Random Rows
Date: Wed, 28 Apr 2010 15:03:34 -0400
Message-ID: <4BD88686.7070005@magwerks.com> (raw)
In-Reply-To: <z2i302670f21004281048n3ed3d9aew9203d8cceec79f74@mail.gmail.com>
References: <q2x302670f21004280922ic25b4f91k968effc6926a6243@mail.gmail.com>
	<20335.1272474358@sss.pgh.pa.us>
	<z2i302670f21004281048n3ed3d9aew9203d8cceec79f74@mail.gmail.com>

On 4/28/2010 1:48 PM, Gary Chambers wrote:
> pen?
>    
> The clouds parting, choirs of angels singing, and fireworks
> celebrating the veil of my obtuseness being lifted, and my grasp and
> command of SQL to be complete and infinite.  None of which appears
> will ever happen...
>
> -- Gary Chambers
>
> /* Nothing fancy and nothing Microsoft! */
>
>    
You now what *_might _*work

Insert into useraddrs(userid, addrdesc, city, stprov)
select u.userid, 'Home', c.cityname, c.stateabbr FROM users u, cities c
WHERE u.userid NOT IN (SELECT userid FROM useraddrs)
and cid IN (select round(random()*10000)::int as num from 
generate_series(1,100000)) rand )

As you don't care if a record repeats


All legitimate Magwerks Corporation quotations are sent in a .PDF file attachment with a unique ID number generated by our proprietary quotation system. Quotations received via any other form of communication will not be honored.

CONFIDENTIALITY NOTICE: This e-mail, including attachments, may contain legally privileged, confidential or other information proprietary to Magwerks Corporation and is intended solely for the use of the individual to whom it addresses. If the reader of this e-mail is not the intended recipient or authorized agent, the reader is hereby notified that any unauthorized viewing, dissemination, distribution or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and destroy all occurrences of this e-mail immediately.
Thank you.

view thread (7+ messages)  latest in thread

Message-ID: <4BD88686.7070005@magwerks.com>
Permalink:  ../4BD88686.7070005@magwerks.com/
Also on:    postgresql.org/message-id/4BD88686.7070005@magwerks.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: justin@magwerks.com, gwchamb@gmail.com
  Subject: Re: Inserting Multiple Random Rows
  In-Reply-To: <4BD88686.7070005@magwerks.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox