Created
August 4, 2013 13:33
-
-
Save halilim/6150326 to your computer and use it in GitHub Desktop.
Bitki puan sırası
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
t.bid, t.badi, t.averaj, t.sira | |
FROM ( | |
SELECT b.bid, b.badi, p.averaj, @sira := @sira + 1 AS sira | |
FROM bitki b | |
JOIN (SELECT @sira := 0) r | |
INNER JOIN (SELECT bid,AVG(puan) averaj FROM puanlar GROUP BY bid) p ON p.bid=b.bid | |
ORDER BY p.averaj DESC | |
) t | |
WHERE t.bid = 3; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment