Sql filtering id's -


i want create sql query lets me make top 5 of used ids in table. table has these columns:

reservationid costumerid roomid hotelid 

i'm trying top 5 of used hotel ids.

i thought had use count function doesn't seem work. counts hotelids , doesn't see difference between id's

select count(hotelid) reservation; 

can me push me in right direction?

thanks in advance!

select count(`hotelid`) `freq`, `hotelid` `reservation` group `hotelid` order `freq` desc limit 5 ; 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -