Skip site navigation (1) Skip section navigation (2)

Re: Possible use of a subselect?

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: "Adam Erickson" <adamre(at)cox(dot)net>
Cc: "Pgsql-Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Possible use of a subselect?
Date: 2002-05-27 07:44:50
Message-ID: (view raw or whole thread)
Lists: pgsql-novice
On Sun, 26 May 2002 23:43:50 -0500, "Adam Erickson" <adamre(at)cox(dot)net>
>Given the table structure:
>id serial int4
>stringid int4 not null
>language varchar(32)
>content varchar(255)
>I'm trying to get a query that will return the
>English version of every string ("SELECT id,content FROM STRING WHERE
>language='English' and stringid=0") and their translated counterpart (say,
>Korean) which would be ("SELECT content FROM string WHERE

no need for a subselect.  Try an outer join:

SELECT, e.content, k.content
FROM string e LEFT JOIN string k
    ON = k.stringid
WHERE e.stringid = 0 AND k.language = 'Korean';


In response to


pgsql-novice by date

Next:From: Manfred KoizarDate: 2002-05-27 07:53:41
Subject: Re: Possible use of a subselect?
Previous:From: Rasmus MohrDate: 2002-05-27 07:36:37
Subject: Re: Copy Comand question

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group