Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Can someone help with this query

Can someone help with this query

From: <clinttoris_at_hotmail.com>
Date: 29 Jun 2006 08:50:16 -0700
Message-ID: <1151596216.816904.305420@i40g2000cwc.googlegroups.com>


Hello Oracle experts,

Well I need help changing the following query that I have constructed. I am really new at Oracle but trying my best.

I need to create a report using crystal reports where at the top I show summary data and that encompasses all data up until current date(sysdate). Then at the bottom I need to show a graph for the last 12 Months. Based on my syntax, my graph includes blank dates. My syntax will clarify what I mean. I need to graph only 12 months but at the same time show everything up above. This is not doable in crystal reports unless I include a sub report but I don't want to do this. I hate using subs especially with stored procedures. Is it doable, almost like having 2 separate queries into 1. I have used simple case statements.

So here goes
SELECT case_id_,
(CASE when convert_utc_date(Arrival_time,'EST') between trunc(sysdate -
7*2, 'DAY') and trunc(sysdate,'DAY')-(1/24/60/60) then 1 else 0 END) AS New,
(CASE when Status NOT IN (4,5) and convert_utc_date(Arrival_time,'EST')
between trunc(sysdate - 7*2, 'DAY') and
trunc(sysdate,'DAY')-(1/24/60/60) then 1 else 0  END) AS TotalOpen,
(CASE when convert_utc_date(Arrival_time,'EST') between
add_months(trunc(sysdate,'MM'),-11) and
trunc(sysdate,'DAY')-(1/24/60/60) then 1 else 0  End)AS Last12Months,
 (CASE when Status NOT IN (4,5) and
convert_utc_date(Arrival_time,'EST') between add_months(trunc(sysdate,'MM'),-11) and
trunc(sysdate,'DAY')-(1/24/60/60) then
convert_utc_date(Arrival_time,'EST')
End)Last12MonthsRecordSelection
 FROM hpd_helpdesk

Result Set will look like this

Ticket17777	0	0	1	(null)
Ticket15555	0	0	1	13-MAR-06
Ticket19648	0	0	1	(null)

I don't want to exclude the blanks overall, but exlucde them from being shown only in the graph. Your help is appreciated. Received on Thu Jun 29 2006 - 10:50:16 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US