Need to show other columns for SUM

Поиск
Список
Период
Сортировка
От Chuck Roberts
Тема Need to show other columns for SUM
Дата
Msg-id 011ac9510bd1b5258562f2584d9484eb@mail.gmail.com
обсуждение исходный текст
Список pgsql-novice

Postgresql 8.4.

 

Thank you for the help. This did what I wanted:

 

SELECT j.armasterid, substring(j.ccdescription from 1 for 15) as desc, j.ccpromisedate as promdate, j.ccmasterid as jobid, sum(jc.jcactcost) as sumactcost 

FROM job j

JOIN jobcost jc ON (j.ccmasterid = jc.ccmasterid)

WHERE (j.ccpromisedate BETWEEN '2014-07-01' AND '2014-07-05') AND (jc.jcactcost > 0)

GROUP BY  j.ccmasterid, j.armasterid, j.ccdescription, j.ccpromisedate

ORDER BY j.ccmasterid ;

 

I just have to add the other columns I want to show in the GROUP BY clause.

 

Everyone has different ways of learning, and I didn't find what I needed via Google. In case you were wondering, I learn better by example, and this example will help me a lot in other things I have to do. Thanks!

 

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

Предыдущее
От: Gavin Flower
Дата:
Сообщение: Re: Need to show other columns for job table along with summing job cost
Следующее
От: Benoit Izac
Дата:
Сообщение: Re: Need to show other columns for job table along with summing job cost