Re: Help writing a piece of SQL - Mailing list pgsql-sql

From Niklas Johansson
Subject Re: Help writing a piece of SQL
Date
Msg-id 3F3A99C3-2368-4DD2-9396-2A2C23B14CF1@tele2.se
Whole thread Raw
In response to Re: Help writing a piece of SQL  ("Nigel Bishop" <Nigel.Bishop@ioko.com>)
List pgsql-sql
On 3 feb 2006, at 14.06, Nigel Bishop wrote:

> Thank you very much, that did the business


This should generate the same plan as the previous query, but be a  
little bit more clean and easy to read:

SELECT sendto FROM users t1
WHERE domain='rusty.com' AND
username = COALESCE((SELECT username FROM users WHERE username='fred'  
and domain=t1.domain), username);



Sincerely,

Niklas Johansson





pgsql-sql by date:

Previous
From: "Nigel Bishop"
Date:
Subject: Re: Help writing a piece of SQL
Next
From: Philly Mandiza
Date:
Subject: UnixODBC-2.2.8-2.3.0 driver