Re: Error filling record group with nested select

From: DA Morgan <damorgan_at_x.washington.edu>
Date: Wed, 19 Jan 2005 14:41:34 -0800
Message-ID: <41eee212$1_2_at_127.0.0.1>


Frank Piron wrote:

> Am 19 Jan 2005 04:01:51 -0800 schrieb Javier Coego <javiercoego_at_gmail.com>:
>

>> - Hi, all. -
>>
>> - I'm trying to fill a record group with the values returned by the
>> following query: -
>>
>> select username from user_accounts where username not in (select
>> username from assigned_accounts where end_date<start_date)

>
>
> Try to use table aliases:
>
> select ua.username
> from user_accounts ua
> where ua.username not in (select aa.username
> from assigned_accounts aa
> where aa.end_date < aa.start_date)
>
> Verify the references of end_date and start_date.

And likely NOT EXISTS will perform better than NOT IN.

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Wed Jan 19 2005 - 23:41:34 CET

Original text of this message