Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports - Data Connectivity
Viewing all articles
Browse latest Browse all 269

No rows being returned when using SQL Command

$
0
0

I have written code in Oracle SQL that works fine directly against the Database for pulling back data for the last 30 days.

 

When I add this to Crystal Report as a Command it runs but returns no rows and appears to be mistranslating the last 30 day code

 

SQL statement is below with the filter that seems to be failing in Crystal

 

select distinct e.event_key,H.HOSPITAL_NUMBER, EC.MODALITY,  E.PATIENT_TYPE,E.BOOKING_TYPE, E.URGENT, E.BOOK_MODE,

                                        EX.EXAMINATION, EC.EXAMCD_NAME,E.REQUEST_DATE, '' as ClockResetDate, E.EVENTS_DATE,

                (Select count(*) from CRIS.status st Where st.event_key = e.event_key AND st.status_type = 'WPD') as Planned

from cris.events e

inner join cris.exams ex on e.event_key = ex.event_key

left join cris.hospnos h on e.computer_number = h.computer_number

inner join cris.examcd ec on ex.examination = EC.CODE

inner join cris.status s on E.EVENT_KEY=S.EVENT_KEY

where   e.events_date between to_char(current_date-30,'DD-MON-YYYY') AND to_char(current_date-1,'DD-MON-YYYY')

and (ec.modality = 'U' OR ec.modality ='M' OR ec.modality ='C')

and S.STATUS_CURRENT='Y' and S.STATUS_TYPE='ATP'

and EX.DELETED<>'Y' and h.hospital='RAE'

ORDER BY e.event_key

 

My understanding was that this SQL is run directly against the DB so I'm struggling to understand why I get the results fine when running this SQL directly against the DB, but Crystal fails to return anything??

 

Help!!


Viewing all articles
Browse latest Browse all 269

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>