Sub-queries in Discoverer - urgent! [message #88743] |
Mon, 03 March 2003 04:42 |
Eleanor Prior
Messages: 1 Registered: March 2003
|
Junior Member |
|
|
Hi,
I have to create a workbook in Discoverer that involves a sub-query. I know sub-queries can be selected on the desktop edition when creating worksheets but I can't get it to work, as I am selecting a count in my main query and I want to sub-query the value I am counting. This SQL brings me back the correct values when I run it through SQL*Plus - I have included it here. Can I do this in Discoverer without resorting to a custom SQL folder?
SELECT count(distinct com.complaint_num)
FROM complaints com,
court_orders co,
court_diary_sittings cds
WHERE co.case_id = com.case_id
and co.complaint_num = com.complaint_num
and co.cds_id = cds.cds_id
and com.case_id = 20015
and cds.courtroom_date < to_date('19-aug-2002')
and com.complaint_num NOT IN
(
SELECT distinct com.complaint_num
FROM complaints com,
court_orders co,
court_diary_sittings cds,
order_frames orf
WHERE co.case_id = com.case_id
AND co.active_ind = 'Y'
and orf.order_frame_code = co.order_frame_code
and orf.frame_version_num = co.frame_version_num
and orf.final_ord_ind = 'Y'
and co.cds_id = cds.cds_id
and com.case_id = 20015
and cds.courtroom_date < to_date('19-sep-2002')
)
Thanks in advance :)
|
|
|
|