Re: Join three tables and specify criteria... I know this should be easy!

From: Paul Linehan <linehanp(at)tcd(dot)ie>
To: Ken Benson <Ken(at)infowerks(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Join three tables and specify criteria... I know this should be easy!
Date: 2014-08-29 17:07:56
Message-ID: CAF4RT5TbZzAAQ=7AWVGa=yLYvMW1fddnrft9+t7SK0okzi08-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

2014-08-29 17:59 GMT+01:00 Ken Benson <Ken(at)infowerks(dot)com>:

Hi Ken, and thanks for your input,

but there's no u.user_language field - user_language is a
joining table - otherwise, I'd have to have a record in the
user table for each language spoken which would not
be very normalised (or elegant :-) ).

Paul...

> SELECT DISTINCT u.user_id
> FROM user u
> JOIN user_language ul
> ON u.user_id = ul.ul_user_id
> JOIN language l
> ON ul.ul_iso_code = l.iso_code
> WHERE u.user_language IN ('EN','DE')

--

linehanp(at)tcd(dot)ie

Mob: 00 353 86 864 5772

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ken Benson 2014-08-29 17:11:47 Re: Join three tables and specify criteria... I know this should be easy!
Previous Message Naresh Kumar 2014-08-29 17:05:11 Re: Join three tables and specify criteria... I know this should be easy!