MySQL Forums
Forum List  »  Oracle

Re: Oracle rank function and MySQL
Posted by: Torsten Altmann
Date: March 24, 2008 01:24PM

Hello, Mr. Brawley!

I'm very impressed of the code for the ranking function, but I have to tell, that I didn't understand it yet. I tried several select-views to get the clue, but I didn't. Could you manage to change the code for ranking for something like this:
-- Example table
CREATE TABLE tmp(name CHAR(10), pts1 INT, pts2 INT);
INSERT INTO tmp VALUES
('A',12,20),('B',10,25),('C',15,21),('D',12,21),('E',12,20),('F',13,24);

-- View with Ranking depending on pts1 AND pts2
SELECT t1.name, t1.pts1, t1.pts2, COUNT(t1.pts1) AS Rank
FROM tmp t1
JOIN tmp t2 ...
GROUP BY t1.name, ...
ORDER BY t1.pts1 DESC, t1.pts2 DESC, t1.name DESC;

I think, this would be a great clue!

Thanks in advance

Options: ReplyQuote


Subject
Views
Written By
Posted
25665
June 11, 2006 05:56AM
Re: Oracle rank function and MySQL
12438
March 24, 2008 01:24PM
8369
December 25, 2006 03:50AM


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.