sql server - SQL: How to display the top 10 list of the users name who has the most item? -


i new sql , thought need basics.

i want display top 10 users name , amount of users friends. how ?

the top 10 list out user has friends count in descending order proble m have no clue how code .

app_id user

app_friends_id users friends

app_id     app_friends_id     40          20  40          10  30          30  40          50 

there 3 app_id 40 , want display app_id 40 , app_friends_id's total count 3. sorry bad explanation.

if understand, can try this:

select top 10 app_id,count(app_id) 'count_of_friend'  table  group app_id  order 2 desc 

the result is:

app_id        count_of_friend    40                3    30                1 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -