Re: Need help with OUTER JOIN...SOLVED

From: Matt Foster <Matthew(dot)Foster(at)noaa(dot)gov>
To: Richard Broersma <richard(dot)broersma(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Need help with OUTER JOIN...SOLVED
Date: 2011-11-18 18:40:38
Message-ID: 4EC6A6A6.3090402@noaa.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 11/18/2011 12:15 PM, Richard Broersma wrote:
> On Fri, Nov 18, 2011 at 9:44 AM, Matt Foster<Matthew(dot)Foster(at)noaa(dot)gov> wrote:
>
>> SELECT office_list.office, verification_data.period
>> FROM office_list
>> LEFT OUTER JOIN verification_data USING (office)
>> WHERE start_time> 'yesterday'
>> AND start_time< 'today'
>> AND period=1
>> AND name='foo'
>> AND element='bar';
>
> 1) Replace the USING() to ON office_list.office = verification_date.office
>
> Find all of the columns in your WHERE clause that are in your
> Verification_Data table and move these criteria to ON clause.
>
> SELECT office_list.office, verification_data.period
> FROM office_list
> LEFT OUTER JOIN verification_data
> ON Office_list.office = verification_data.office
> AND start_time> 'yesterday'
> AND start_time< 'today'
> WHERE period=1
> AND name='foo'
> AND element='bar';
>
>
>

Hey...that works! Thank you, Richard!

--
Do not go where the path may lead; go instead where there is no path and leave a trail.
-- Ralph Waldo Emerson

Attachment Content-Type Size
matthew_foster.vcf text/x-vcard 204 bytes

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Phil Dobbin 2011-11-18 19:04:53 Re: Real novice question: Roles
Previous Message Jean-Yves F. Barbier 2011-11-18 18:26:06 Re: Real novice question: Roles