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

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -