MySQL Forums
Forum List  »  French

Re: Oracle LAG OVER en Mysql
Posted by: Stéphane Guyot
Date: March 28, 2014 02:03AM

Bonjour,

En fait en faisant un inner join j'ai réussi à faire ce que je voulais

select B.DAY as CURRENT_DAY, B.HLRID as CURRENT_HLRID, B.RANK as CURRENT_RANK ,
max(qGetPrev.DAY) as PREVIOUS_DAY,
max(qGetPrev.HLRID) as PREVIOUS_HLRID,
max(qGetPrev.RANK) as PREVIOUS_RANK
from OPM_DATA_DB.ALC_HLR_SUPSER_PEG_HH B
inner join
(
select HLRID, RANK, DAY
from OPM_DATA_DB.ALC_HLR_SUPSER_PEG_HH
) qGetPrev
on qGetPrev.HLRID = B.HLRID and qGetPrev.RANK = B.RANK
and qGetPrev.DAY < B.DAY
group by B.HLRID, B.RANK, B.DAY;

Options: ReplyQuote


Subject
Views
Written By
Posted
3321
March 27, 2014 04:32AM
1920
March 28, 2014 12:40AM
Re: Oracle LAG OVER en Mysql
1561
March 28, 2014 02:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.