From: | Jurgen Defurne <defurnj(at)glo(dot)be> |
---|---|
To: | postgreSQL general mailing list <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: INSERT WITH SELECT help |
Date: | 2000-05-23 16:31:35 |
Message-ID: | 392AB267.83CAE7DA@glo.be |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
ozric wrote:
> I got help from one of our DBA's today here is what I was missing. This
> in not in Bruce's Book.
>
> INSERT INTO address (per_id,street_num,city,state,zip)
> SELECT per_id,'$3','$4','$5','$6' FROM from person
> WHERE last = '$1'
> AND first = '$2';
>
> $1-6 will be supplied by user input from Zope, I just wanted to isolate the
> per_id from person during and Insert so that end users would not need to know
> it was there. I know I might have a problem with getting more then one return
> for
> just first and last, I might add more WHERE statements in there. I am
> just happy to get moving on with my little project.
>
> Thanks for the help
> Richad
Your idea is good, normally you do not want to bother your user with unique
key values. However, have you thought about the fact that more than one
person could have the same first and last names ? Do not confuse the
improbable with the impossible. When names are entered, you should check
how much results you have and probably show another screen on which
the user can select the right person.
Jurgen Defurne
defurnj(at)glo(dot)be
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2000-05-23 17:04:27 | Re: Timezones on Tru64 (Digital Unix) |
Previous Message | ernie cline | 2000-05-23 15:48:06 | quick (and probably dumb) question |