Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.59 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. converting a complex oracle query to hibernate
  2. select
  3.     d.dateInRange as dateval,
  4.     eventdesc,
  5.     nvl(td.dist_ucnt, 0) as dist_ucnt
  6. from (
  7.     select
  8.         to_date('03-NOV-2011','dd-mon-yyyy') + rownum - 1 as dateInRange
  9.     from all_objects
  10.     where rownum <= to_date('31-DEC-2011','dd-mon-yyyy') - to_date('03-NOV-2011','dd-mon-yyyy') + 1
  11. ) d
  12. left join (
  13.     select
  14.         currentdate,
  15.         count(distinct(grauser_id)) as dist_ucnt,
  16.         eventdesc
  17.     from
  18.         txn_summ_dec
  19.  
  20.     group by currentdate, eventdesc
  21. ) td on td.currentdate = d.dateInRange order by d.dateInRange asc