Connecting Tech Pros Worldwide Help | Site Map

Use of OLAP function

  #1  
Old November 20th, 2008, 08:05 PM
sandeep.iitk@gmail.com
Guest
 
Posts: n/a
Hi Friends,
can anybody help me in rewriting below query with the help of OLAP
functions. I never used OLAP functions , so need help in this regard.

SELECT C.UNIT, C.DT from tab1 C where C.DT = (SELECT MAX(C_ED.DT) FROM
tab1 C_ED WHERE C.UNIT = C_ED.UNIT AND C.ID = C_ED.ID AND C_ED.DT <=
CURRENT DATE)

Thanks in advance
Sandy
  #2  
Old November 21st, 2008, 04:25 PM
ChrisC
Guest
 
Posts: n/a

re: Use of OLAP function


On Nov 20, 12:02*pm, "sandeep.i...@gmail.com" <sandeep.i...@gmail.com>
wrote:
Quote:
Hi Friends,
can anybody help me in rewriting below query with the help of OLAP
functions. I never used OLAP functions , so need help in this regard.
>
SELECT C.UNIT, C.DT from tab1 C where C.DT = (SELECT MAX(C_ED.DT) FROM
tab1 C_ED WHERE C.UNIT = C_ED.UNIT AND C.ID = C_ED.ID AND C_ED.DT <=
CURRENT DATE)
>
select unit, dt from (select unit, dt, max(dt) over(partition by unit,
id) as max_dt where dt <= current date) sub
where dt = max_dt

Note that some description behind what this query is supposed to do
would help in figuring out the right answer - this is just a guess
that should replicate what your query is returning.

Chris
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle 9IR2 OLAP and BI Beans - How to get it working DD answers 0 June 27th, 2008 06:49 PM
SQL on DB2 - restrict number of rows returned AnnieLab answers 2 November 12th, 2005 11:44 AM
Oracle 9IR2 OLAP and BI Beans - How to get it working DD answers 0 July 19th, 2005 10:31 PM
Using Python with an OLAP Server Ajith Prasad answers 0 July 18th, 2005 02:12 AM