On 29 December 2015 at 17:35, Raymond O'Donnell <rod@xxxxxx> wrote:
On 29/12/2015 16:23, Killian Driscoll wrote:
> I have a table country with a lookup table to country_type.
>
> table country
>
> country_id (pk), col2, col3, country_type_id (fk) integer
>
> lookup table
>
> country_type country_type_id (pk), type_name varchar
>
> My lookup table has 50 country types, but only 20 are 'in use' in the
> current db (with the rest possibly used later as the db expands). On the
> webpage I am creating (I am using a php generator) I can set it up to
> add a filter by country type based on the country type_name varchar - so
> one can view the country types by name rather than the id integer - but
> all 50 types are listed.
>
> I only want the 20 that currently 'in use' (not sure if this is the best
> way to describe it) and therefore relevant to searches/filters (i.e. I
> don't want to see a "There are no records to display" message).
How do you define "in use"? Is it a switch turned on and off by an
admin? is it based on how often that country is chosen by a user? Maybe
something else?
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.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod@xxxxxx