Skip to content

Instantly share code, notes, and snippets.

@halilim
Created August 4, 2013 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halilim/6150326 to your computer and use it in GitHub Desktop.
Save halilim/6150326 to your computer and use it in GitHub Desktop.
Bitki puan sırası
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