Re: MySQL equivalent Oracle Lag, Partition By - Query Help
There is no LAG function in MySQL, you can find some ideas how to deal with that at:
http://onlamp.com/pub/a/mysql/2007/04/12/emulating-analytic-aka-ranking-functions-with-mysql.html?page=2
It is possible to use global variables (@var) to temporary store the previous values, use and reassign them for every new row within a single SQL SELECT (you do not need to declare such variables).
It does not make the code readable and maintainable :) so you can consider using a stored procedure to get the LAG functionality.
Kind regards, Dmitry Tolpeko
---
SQLWays - Oracle PL/SQL stored procedures, triggers to MySQL migration
http://www.ispirer.com
Subject
Views
Written By
Posted
10677
September 02, 2009 01:08AM
Re: MySQL equivalent Oracle Lag, Partition By - Query Help
14627
September 03, 2009 01:59PM
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.