Does Crystal Reports "Add Command" utility allow you write Case statements.
Can anyone tell me how I can format the Query below into an equivalent query in Crystal Reports, using the "Add Command" utility? Or the Formula tool or the SQL Expression tool? Thanks in advance for any assistance.
Select
run, route,
Sum( CASE
WHEN fs in (1,2,4,5,6,7,8,9) and ev.ts between '2008-04-01 04:00:00.000' and '2008-04-02 03:59:00.000' THEN
ev.rdr_c
END) as "4/1",
Sum( CASE
WHEN fs in (1,2,4,5,6,7,8,9) and ev.ts between '2008-04-02 04:00:00.000' and '2008-04-03 03:59:00.000' THEN
ev.rdr_c
END) as "4/2",
Sum( CASE
WHEN fs in (1,2,4,5,6,7,8,9) and ev.ts between '2008-04-03 04:00:00.000' and '2008-04-04 03:59:00.000' THEN
ev.rdr_c
END) as "4/3"
from dba.ev key join dba.ml
where ev.ts between '2008-04-01 04:00:00.000' and '2008-05-01 03:59:00.000'
and run > 100
and route < 9000
group by run, route
order by run, route
Can anyone tell me how I can format the Query below into an equivalent query in Crystal Reports, using the "Add Command" utility? Or the Formula tool or the SQL Expression tool? Thanks in advance for any assistance.
Select
run, route,
Sum( CASE
WHEN fs in (1,2,4,5,6,7,8,9) and ev.ts between '2008-04-01 04:00:00.000' and '2008-04-02 03:59:00.000' THEN
ev.rdr_c
END) as "4/1",
Sum( CASE
WHEN fs in (1,2,4,5,6,7,8,9) and ev.ts between '2008-04-02 04:00:00.000' and '2008-04-03 03:59:00.000' THEN
ev.rdr_c
END) as "4/2",
Sum( CASE
WHEN fs in (1,2,4,5,6,7,8,9) and ev.ts between '2008-04-03 04:00:00.000' and '2008-04-04 03:59:00.000' THEN
ev.rdr_c
END) as "4/3"
from dba.ev key join dba.ml
where ev.ts between '2008-04-01 04:00:00.000' and '2008-05-01 03:59:00.000'
and run > 100
and route < 9000
group by run, route
order by run, route