Topplista

Databaser & SQL

3 svar · 183 visningar · startad av Andy

Medlem sedan sep. 2001138 inlägg
Trådstart#1

Jag har en tabell som ser ut så här:

UserID | CountryID

Medlem sedan dec. 200012 464 inlägg
#2
select countryID,count(countryID) as numberOfLusers
  from tableThatLooksLikeThis
 group by countryID
 order by 2 desc
Medlem sedan juni 200032 967 inlägg
#3
SELECT CountryID, COUNT(*) AS Antal FROM tblTable GROUP BY CountryID, ORDER BY Antal DESC

Om du använder Access så får du köra ORDER BY 2 DESC istället.

Mvh,

Medlem sedan sep. 2001138 inlägg
#4

Tack! Skall testa så fort jag får möjlighet...

256 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
121 ms — deklarationer (db)
0 ms — hämta statistik (cache)
127 ms — hämta tråd, inlägg och bilagor (db)
126 ms — ändringar (db)