Subject | Re: [firebird-support] sql query |
---|---|
Author | David Johnson |
Post date | 2005-02-24T00:44:58Z |
select
CAST("Date_Time" AS DATE) as call_date
count (*) as call_count
from CALLS a
where call_count > 0
full join
select
CAST("Date_Time" AS DATE) as call_date
count (*) as call_count
from CALLS b
where resolved_count > 0
on a.call_date = b.call_date
I suspect that a full join is overkill, but it allows both for days that
you received no calls but resolved outstanding issues, and for days
where you received calls but resolved none (both are bad situations for
a helpdesk, but that is all the more reason to support them in your
management report).
CAST("Date_Time" AS DATE) as call_date
count (*) as call_count
from CALLS a
where call_count > 0
full join
select
CAST("Date_Time" AS DATE) as call_date
count (*) as call_count
from CALLS b
where resolved_count > 0
on a.call_date = b.call_date
I suspect that a full join is overkill, but it allows both for days that
you received no calls but resolved outstanding issues, and for days
where you received calls but resolved none (both are bad situations for
a helpdesk, but that is all the more reason to support them in your
management report).
On Wed, 2005-02-23 at 18:36, Alexandre Benson Smith wrote:
>
>
> markd_mms wrote:
>
> >sorry about the subject but i'm not quite sure what is that i'm
> >asking...
> >
> >i'm rewriting our internal helpdesk and there's a report that i need
> >to produce to show a summary of calls between particular dates, namely
> >the date, the number of calls logged on that date and the number of
> >calls resolved on that date. so it looks basically like this...
> >
> >Date Logged Resolved
> >----------------------------------------
> >21/02/2005 23 22
> >...
> >
> >i know i can select all calls thusly
> >
> >SELECT COUNT(*), CAST("Date_Time" AS DATE)
> >FROM CALLS
> >//where date between...just testing all calls atm
> >GROUP BY 2
> >ORDER BY 2
> >
> >is there any way of counting the number of resolved calls (theres a
> >"Resolved" column for each call record) in the same query?
> >
> >running firebird 1.5.2.4731
> >
> >TIA
> >
> Hi !
>
> I think there is a bunch of ways to solve this, one is this:
>
> select
> Date,
> sum(Case when Status = '1' then 1 else 0 end),
> sum(Case when Status = '2' then 1 else 0 end),
> sum(Case when Status = '3' then 1 else 0 end)
> from
> PedidoVenda
> group by
> 1
>
> got it ?
>
> see you !
>
> --
>
> Alexandre Benson Smith
> Development
> THOR Software e Comercial Ltda.
> Santo Andre - Sao Paulo - Brazil
> www.thorsoftware.com.br
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>