Hi ,
Could you please give me the Hql to the below Sql.
Iam not able to Convert my Sql Code to Hql according to my Requirement.
First Please tell me that can we convert any given sql to hql ?Is it possible?.
Iam facing some issues with the below Sql Query not able to convert to HQL.
Here is the SQL Query.....
select A.RSI,B.RUN,A.RD,A.RNAME,A.AIND,A.RNUM,A.RSD,A.IE,A.RSSI,A.RECSTATIND,A.CC,
(select repturl from table3 where rptschdlinstance=B.RSI and to_char(run_tmstp,'DD-Mon-YYYY HH24:MI:SS')=B.RUN) REPTURL,
(select errordesc from table3 where rptschdlinstance=B.rsi and to_char(run_tmstp,'DD-Mon-YYYY HH24:MI:SS')=B.run) errordesc,
(select recordstatind from table3 where rptschdlinstance=B.rsi and to_char(run_tmstp,'DD-Mon-YYYY HH24:MI:SS')=B.run) recordstatind
FROM
(select
rsi.rptschdlinstance RSI,r.rept_def_id RD ,r.rept_name RNAME,r.archive_action_ind AIND,r.rept_num RNUM,
rsi.rept_schedule_desc RSD, rsi.is_external IE, rsi.rept_schedule_stat_ind RSSI ,rsi.record_stat_ind RECSTATIND,
rsi.client_comp_id CC from table1 r join table2 rsi on r.rept_def_id =rsi.rept_def_id
where rsi.is_scheduled=1 and r.rept_def_id=4 and rsi.client_comp_id=100002 and rsi.REPT_SCHEDULE_STAT_IND=1) A
LEFT OUTER JOIN
( select hi.rptschdlinstance RSI, max(to_char(hi.run_tmstp,'DD-Mon-YYYY HH24:MI:SS')) run from table3 hi group by hi.rptschdlinstance
) B ON A.RSI=B.RSI WHERE to_date(RUN,'DD-Mon-YYYY HH24:MI:SS') > to_date('15-Nov-2006 10:13:38','DD-Mon-YYYY HH24:MI:SS') or RUN IS NULL ORDER BY B.RUN,A.RSI ;
Relation is Table1 to Table2 one to many
Table2 to Table3 one to many.
Thanks in Advance.
|