|
Hi there,
I currently have a table with census data that is designed as follows: each row represents a location and each column is a language that contains the number of people in that location that speak the language. There are about 20 languages.
It looks something like this.
ID | language1 | language2 | language3|...| language N|
---------------------------------------------
1 |12 | 45 | 20 |...| 30 |
---------------------------------------------
2 | 50 | 40 | 10 |...| 60 |
---------------------------------------------
3 | 20 | 10 | 40 |...| 30 |
What I want to do is find out the top 5 languages spoken at each location.
Is there a query that will do this? I envision the final query table to look like this:
ID | First | Second | Third | Fourth| Fifth|
---------------------------------------------
1 | language2 | language N | language 3 |...| language 1 |
---------------------------------------------
2 | language1 | language 2 | language N |...| language 3 |
---------------------------------------------
3 | language3 | language N | language 1 |...| language 2 |
Thanks for the help!
|