Skip navigation links

MySQL Forums :: Transactions :: ROW_NUMBER Simulation


Advanced Search

ROW_NUMBER Simulation
Posted by: Michael Binnen ()
Date: July 18, 2007 07:15AM

Hi!

I'm looking for a solution to simulate the ROW_NUMBER() OLAP Function know in other Database like Oracle, Teradata or DB2.

One solution is:
SET @rank = 0;

SELECT name,
(@rank := IF(@prev_name=name,@rank+1,1)) AS rownumb,
(@prev_basket := name)

But I don't know why for example, testing in querybrowser, the var @rank won't be set. The var ist always NULL. So that mean that the colum rownumb will always be 1.
I have the same when I do it in perl.

Have I set any systemvar for using vars?

thx
Michael

Options: ReplyQuote


Subject Views Written By Posted
ROW_NUMBER Simulation 22994 Michael Binnen 07/18/2007 07:15AM
Re: ROW_NUMBER Simulation 9193 William Chiquito 07/18/2007 07:55AM
Re: ROW_NUMBER Simulation 6919 Michael Binnen 07/24/2007 08:11AM


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.