pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: User input to queries
Date: Wed, 9 Dec 2020 10:29:24 -0700
Message-ID: <8e5a9074-eca1-c926-2af0-22f3a5f7a3a9@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.20.2012090855520.10199@salmo.appl-ecosys.com>
References: <alpine.LNX.2.20.2012090855520.10199@salmo.appl-ecosys.com>


On 12/9/20 10:03 AM, Rich Shepard wrote:
> While I develop the application's GUI I use the database from the command
> line (psql). While some queries are self-contained others need user 
> input.
> I've not found a search term that locates this information in the
> postgres-12 user manual and my web searches suggest that using '&' should
> work.
>
> I tried the latter with this query but postgres didn't like it. (There 
> may
> well be other errors in it so don't hesitate to point out my mistakes.)
>
> ------
> /* This query selects all activity information for a named person */
>
> /* Specify columns */
> SELECT p.lname, p.fname, p.loc_nbr, p.job_title, p.direct_phone, 
> p.active,
>        o.org_name,
>        l.loc_nbr, l.loc_name,
>        a.act_date, a.act_type, a.notes, a.next_contact
> /* Specify tables. */ FROM People AS p
>      JOIN Organizations AS o ON o.org_nbr = p.org_nbr
>      JOIN Locations AS l ON l.org_nbr = o.org_nbr and l.loc_nbr = 
> p.loc_nbr
>      JOIN Activities AS a ON a.person_nbr = p.person_nbr
> /* Specify rows */ WHERE p.lname = &p.lname AND p.fname = &p.fname;
> -----
>
> Suggestions on what I should read to learn more about this subject are
> appreciated.
>
> Regards,
>
> Rich
>
>

Put the query in a file, set the desired name, then from psql

    \i filename

Edit pfname, repeat

view thread (14+ messages)  latest in thread

Message-ID: <8e5a9074-eca1-c926-2af0-22f3a5f7a3a9@gmail.com>
Permalink:  ../8e5a9074-eca1-c926-2af0-22f3a5f7a3a9@gmail.com/
Also on:    postgresql.org/message-id/8e5a9074-eca1-c926-2af0-22f3a5f7a3a9@gmail.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: robjsargent@gmail.com
  Subject: Re: User input to queries
  In-Reply-To: <8e5a9074-eca1-c926-2af0-22f3a5f7a3a9@gmail.com>
  References: <alpine.LNX.2.20.2012090855520.10199@salmo.appl-ecosys.com> <8e5a9074-eca1-c926-2af0-22f3a5f7a3a9@gmail.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