Boa tarde ,
Preciso gerar um relatorio de logs utilizando uma tabela onde tenho o codigo do projeto, e quem perticipa de cada projeto e a soma de alguns campos.
select projectid,firstname, lastname,descproject,dtrun,dtfrom,dtto,(sum(satbillable)+sum(sunbillable)+sum(monbillable)+sum(tuebillable)+sum(wedbillable)+ sum(thubillable)+sum(fribillable)) as billable, (sum(satnb)+sum(sunnb)+sum(monnb)+sum(tuenb)+sum(wednb)+ sum(thunb)+sum(frinb)) as nobillable from tabela_log
só que ele precisa de um group by:
select projectid,firstname, lastname,descproject,dtrun,dtfrom,dtto,(sum(satbillable)+sum(sunbillable)+sum(monbillable)+sum(tuebillable)+sum(wedbillable)+ sum(thubillable)+sum(fribillable)) as billable, (sum(satnb)+sum(sunnb)+sum(monnb)+sum(tuenb)+sum(wednb)+ sum(thunb)+sum(frinb)) as nobillable from tabela_log group by projectid
Só que quando faço isso, ele só me traz um participante de cada projectid
Já tentou acrescentar outros campos no Group By como firstname
select projectid,firstname, lastname,descproject,dtrun,dtfrom,dtto,(sum(satbillable)+sum(sunbillable)+sum(monbillable)+sum(tuebillable)+sum(wedbillable)+ sum(thubillable)+sum(fribillable)) as billable, (sum(satnb)+sum(sunnb)+sum(monnb)+sum(tuenb)+sum(wednb)+ sum(thunb)+sum(frinb)) as nobillable from tabela_log group by projectid AND firstname