Re: Refining query statement

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Refining query statement
Date: 2019-01-15 18:31:40
Message-ID: 641fb2e0-fbaa-c477-e43d-e0bdaef6e19d@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On 1/15/19 9:02 AM, Ron wrote: select distinct on (C.contact_id)
C.contact_id, C.lname, C.fname, C.direct_phone, O.org_name, A.next_contact
>>      from Contacts as C
>>        join Organizations as O on C.org_id = O.org_id
>>        join Activities as A on C.contact_id = A.contact_id
>>      where A.next_contact <= 'today'
>>        and A.next_contact > '2018-12-31'
>>      order by c.contact_id, a.next_contact DESC;
>
> And I've never liked this method (though I'm old and crotchety)....
>
I suspect I can match your old and crotchety, but jump in, the water is
fine (once you get used to it)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alexander Farber 2019-01-15 19:17:26 Re: aggregate functions are not allowed in UPDATE
Previous Message Thomas Kellerer 2019-01-15 17:45:53 Re: Refining query statement