pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Fuhr <mike@fuhr.org>
To: Dan Tenenbaum <dandante@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: getting a query column to return 0 if nothing matches
Date: Tue, 3 Jan 2006 19:42:47 -0700
Message-ID: <20060104024246.GA10993@winnie.fuhr.org> (raw)
In-Reply-To: <65029d820601031415w34794135v307ef13b37d5cd10@mail.gmail.com>
References: <65029d820601031415w34794135v307ef13b37d5cd10@mail.gmail.com>

On Tue, Jan 03, 2006 at 02:15:25PM -0800, Dan Tenenbaum wrote:
> I want to show all rows where the first part of the WHERE clause is true,
> regardless of whether the provider_key is in the login_provider table (in
> that cause, I want to show 0 in that column).

Sounds like you're looking for an outer join.

http://www.postgresql.org/docs/8.1/interactive/tutorial-join.html
http://www.postgresql.org/docs/8.1/interactive/queries-table-expressions.html

-- 
Michael Fuhr



view thread (2+ messages)

Message-ID: <20060104024246.GA10993@winnie.fuhr.org>
Permalink:  ../20060104024246.GA10993@winnie.fuhr.org/
Also on:    postgresql.org/message-id/20060104024246.GA10993@winnie.fuhr.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: mike@fuhr.org, dandante@gmail.com
  Subject: Re: getting a query column to return 0 if nothing matches
  In-Reply-To: <20060104024246.GA10993@winnie.fuhr.org>

* 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