Subquery in reports [message #89704] |
Tue, 29 June 2004 23:27 |
shofi
Messages: 9 Registered: October 2001
|
Junior Member |
|
|
Hi,
I am facing a problem. I have a subquery in the report. When the query result is one it is coming. But when the query result is more than one the error message is coming 'Single-row subquery returns more than one row' and the report is not coming. I have given the query below. Here the :start_date & :end_date is given by a user parameter. Could you please help me?
SELECT ALL rownum,id i,name n, basic b,baad d,baar r,totalba t
FROM BACK_HISTORY
WHERE NAME = (SELECT ALL BACK_HISTORY.name
FROM BACK_HISTORY
where to_char(paydate, 'MMYYYY') = to_char(:Start_DATE, 'MMYYYY')
minus
SELECT ALL BACK_HISTORY.name
FROM BACK_HISTORY
where to_char(paydate, 'MMYYYY') = to_char(:end_DATE, 'MMYYYY'))
|
|
|
Re: Subquery in reports [message #89706 is a reply to message #89704] |
Wed, 30 June 2004 02:39 |
vicky
Messages: 14 Registered: October 2000
|
Junior Member |
|
|
Try changing to this:
SELECT ALL rownum,id i,name n, basic b,baad d,baar r,totalba t
FROM BACK_HISTORY
WHERE NAME IN (SELECT ALL BACK_HISTORY.name
FROM BACK_HISTORY
where to_char(paydate, 'MMYYYY') = to_char(:Start_DATE, 'MMYYYY')
minus
SELECT ALL BACK_HISTORY.name
FROM BACK_HISTORY
where to_char(paydate, 'MMYYYY') = to_char(:end_DATE, 'MMYYYY'))
|
|
|