Re: Query to get the min of the total

Поиск
Список
Период
Сортировка
От Marta Pérez Romero
Тема Re: Query to get the min of the total
Дата
Msg-id CACnbkr=9bGSc2HBDb2-=WkLni_DUEVdhEikaFSTt5tXFyAgkzA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Query to get the min of the total  ("Oliveiros d'Azevedo Cristina" <oliveiros.cristina@marktest.pt>)
Список pgsql-novice
The below works!!! I am investigating if it covers everything, but looks good!
Thanks a mill!!!!

On 4 May 2012 12:12, Oliveiros d'Azevedo Cristina <oliveiros.cristina@marktest.pt> wrote:
SELECT *
FROM
(
SELECT petname,SUM(quantity) as total
FROM pets a
NATURAL JOIN sales b
GROUP BY petname
) x
NATURAL JOIN
(SELECT MIN(total) as total
FROM
(
SELECT petname,SUM(quantity) as total
FROM pets a
NATURAL JOIN sales b
GROUP BY petname
)y
)z

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

Предыдущее
От: "Oliveiros d'Azevedo Cristina"
Дата:
Сообщение: Re: Query to get the min of the total
Следующее
От: James David Smith
Дата:
Сообщение: Import CSV with Dates & Times