Re: Subquery to select max(date) value

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Subquery to select max(date) value
Дата
Msg-id alpine.LNX.2.20.1902121443290.15295@salmo.appl-ecosys.com
обсуждение исходный текст
Ответ на Subquery to select max(date) value  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Subquery to select max(date) value  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
On Tue, 12 Feb 2019, Jeff Ross wrote:

> Try (select (max(A.next_contact) from A)

Thanks, Jeff.

The syntax accepted by psql is
A.next_contact = (select (max(A.next_contact)) from Activities as A)
but the date is not included in the output.

The revised statement is now:
select (P.person_id, P.lname, P.fname, P.direct_phone, O.org_name, A.next_contact)
from People as P, Organizations as O, Activities as A
where P.org_id = O.org_id and P.person_id = A.person_id and
       A.next_contact = (select (max(A.next_contact)) from Activities as A)
group by A.next_contact, O.org_id, P.person_id;

This produces the first 5 colums in the outer select but no next_contact
date. When I move A.next_contact to the head of the select list each row
begins with 'infinity'.

I'm still missing the requisite knowledge.

Rich


В списке pgsql-general по дате отправления:

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Re: Subquery to select max(date) value [RESOLVED]
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Subquery to select max(date) value