Lemune wrote:
Quote:
Hello everyone. My problem is I want to make a query that will produce
table that look like crosstab report. My table is tblTransaction with
field Name, DateTimeHappened, Duration, ConnectionType. ConnectionType
will have 4 value: Local, Interlocal, International and Unknown. I want
make crosstab that will calculate total duration on each person and
will show the total duration on each type of connection and if possible
it will sort (order by) by Total duration. |
select
name,
sum(duration) as "total",
sum(case when connectiontype = 'local' then Duration end) as "local",
sum(case when connectiontype = 'interlocal' then Duration end) as
"interlocal",
...
from tab
group by name
order by sum(duration) desc
Dieter