Re: getting a query column to return 0 if nothing matches - Mailing list pgsql-sql

From Michael Fuhr
Subject Re: getting a query column to return 0 if nothing matches
Date
Msg-id 20060104024246.GA10993@winnie.fuhr.org
Whole thread Raw
In response to getting a query column to return 0 if nothing matches  (Dan Tenenbaum <dandante@gmail.com>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: frank church
Date:
Subject: Loading lots of data in a SQL command
Next
From: Richard Huxton
Date:
Subject: Re: Loading lots of data in a SQL command