From: Raymond O'Donnell <rod@iol.ie>
To: Killian Driscoll <killiandriscoll@gmail.com>
To: PostgreSQLPHP <pgsql-php@postgresql.org>
Subject: Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql
Date: Tue, 29 Dec 2015 16:59:31 +0000
Message-ID: <5682BBF3.1020605@iol.ie> (raw)
In-Reply-To: <CAL64pZOJZ+1=bzz8gtqAbxngYuFuJs+gJpeuBuuUrC61SeRGyw@mail.gmail.com>
References: <CAL64pZNGxLQZ=haCh4Fu0H49VtjGPH8g7ced5Te4gorB1j7ciA@mail.gmail.com>
<5682B63E.9030008@iol.ie>
<CAL64pZOJZ+1=bzz8gtqAbxngYuFuJs+gJpeuBuuUrC61SeRGyw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-php>
On 29/12/2015 16:47, Killian Driscoll wrote:
> Hi,
> I posted my reply to the pgsql-php mailing list but in the meantime I
> got an email to say I was removed from the list: I just joined it so I
> don't know why I was removed....
Hi Killian,
Odd - I'll post this to the list also so others will see it.
> Anyhow, below is the reply I tried to post:
>
> Apologies - 'in use' is my grasping at describing it, and as I guessed
> it was unclear. By 'in use' I mean that from my 50 lookup options for
> county types, to date in the db only 20 country types have been used,
> i.e. my db's countries are of 20 types, e.g. country 1 is type
> 'glorious', country 2 is type 'barren', but no country so far is type
> 'lucky': when one uses the webpage filter I only want the type lookups
> used to date to be seen, i.e. 'glorious' or 'barren', but not 'lucky' as
> the latter would result in a "There are no records to display" message.
Ah, OK, I understand now. I'd imagine a simple inner join between the
two tables should do the trick - you'll get only those rows which exist
in both tables. Something like this:
select [whatever]
from country_table ct
inner join lookup_table lt on (ct.country_type_id = lt.country_type_id)
[etc]
Is this what you need?
Hope the weather's a bit better in Dublin than it is here in Galway -
we're getting lashed by Frank at the moment. :-)
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie
--
Sent via pgsql-php mailing list (pgsql-php@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-php
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-php@postgresql.org
Cc: rod@iol.ie, killiandriscoll@gmail.com
Subject: Re: How to limit dropdown list to options based on 'in use' rows from lookup table, for webpage using php and postgresql
In-Reply-To: <5682BBF3.1020605@iol.ie>
References: <CAL64pZNGxLQZ=haCh4Fu0H49VtjGPH8g7ced5Te4gorB1j7ciA@mail.gmail.com> <5682B63E.9030008@iol.ie> <CAL64pZOJZ+1=bzz8gtqAbxngYuFuJs+gJpeuBuuUrC61SeRGyw@mail.gmail.com> <5682BBF3.1020605@iol.ie>
* 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