mysql - Simple SQL Select Query between 2 tables -


i have 2 table

first table - usertable  usedid  username 1          somename 2          someothername  second table - ratingtable  userid ratingvalue 1          5 1          3 1          5 1          3 2          5 2          5 2          3 2          5 

i need write sql query userid in ascending order number of times rated (5 star)

select u.userid, u.username, count(*) ratingcount     usertable u         inner join ratingtable r             on u.userid = r.userid                 , r.ratingvalue = 5     group u.userid, u.username     order ratingcount 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -