Adding the grouped feilds
Posted: Mon Jul 25, 2005 2:03 pm
Ok, so I have a query:
It selects everything that doesn't fall into a predefined category. I want it to take the duplicate entries (cic, dpc, and opc being the same) and add the usage time of the grouped entries and have it display a total for each group. How would I do this?
Code: Select all
select
TIMEDIFF(endTime,startTime) AS 'usage',
ediss7.opc,
ediss7.dpc,
ediss7.cic,
editrunkgroup.trunkGroup,
editrunkgroup.pointCode2,
editrunkgroup.pointCode1,
ediss7.startTime,
ediss7.endTime from ediss7 left join editrunkgroup
on ((ediss7.cic >= editrunkgroup.ciclow and
ediss7.cic <=editrunkgroup.cichigh)and
((ediss7.opc = editrunkgroup.pointcode1 or ediss7.opc
= editrunkgroup.pointcode2)
and (ediss7.dpc = editrunkgroup.pointcode1 or
ediss7.dpc = editrunkgroup.pointcode2)))
Where
(editrunkgroup.trunkGroup is null) Group by ediss7.cic, ediss7.dpc, ediss7.opc