Created
February 27, 2014 14:54
-
-
Save 2803media/9251619 to your computer and use it in GitHub Desktop.
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
en sql | |
SET @rank := 0; | |
SELECT nom_ville,CODGEO,nbr_habitants,@rank := @rank + 1 AS rank | |
FROM cm_datas | |
ORDER BY cast(`nbr_habitants` as decimal) DESC | |
en php | |
mysql_query("SET @rank:=0;"); | |
$sql=" | |
SELECT nom_ville,CODGEO,nbr_habitants,@rank := @rank + 1 AS rank | |
FROM cm_datas | |
ORDER BY cast(nbr_habitants as decimal) DESC | |
"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment