Re: Join three tables and specify criteria... I know this should be easy! - Mailing list pgsql-novice

From Ken Benson
Subject Re: Join three tables and specify criteria... I know this should be easy!
Date
Msg-id d406d2d411074c3fbd76475197192418@BY2PR02MB028.namprd02.prod.outlook.com
Whole thread Raw
In response to Re: Join three tables and specify criteria... I know this should be easy!  (Paul Linehan <linehanp@tcd.ie>)
Responses Re: Join three tables and specify criteria... I know this should be easy!  (Paul Linehan <linehanp@tcd.ie>)
List pgsql-novice

 

 

Whoops:

 

Should be WHERE ul. iso_code IN ('EN','DE')

 

 

 

From: Paul Linehan [mailto:linehanp@tcd.ie]
Sent: Friday, August 29, 2014 10:08 AM
To: Ken Benson
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Join three tables and specify criteria... I know this should be easy!

 




2014-08-29 17:59 GMT+01:00 Ken Benson <Ken@infowerks.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@tcd.ie
 
Mob: 00 353 86 864 5772

pgsql-novice by date:

Previous
From: Paul Linehan
Date:
Subject: Re: Join three tables and specify criteria... I know this should be easy!
Next
From: Paul Linehan
Date:
Subject: Re: Join three tables and specify criteria... I know this should be easy!