SQL Group By with an Order By

前端 未结 6 2237
时光取名叫无心
时光取名叫无心 2020-11-28 03:08

I have a table of tags and want to get the highest count tags from the list.

Sample data looks like this

id (1) tag (\'night\')
id (2) tag (\'awesome         


        
6条回答
  •  粉色の甜心
    2020-11-28 03:47

    Try this query

     SELECT  data_collector_id , count (data_collector_id ) as frequency 
        from rent_flats 
        where is_contact_person_landlord = 'True' 
        GROUP BY data_collector_id 
        ORDER BY count(data_collector_id) DESC
    

提交回复
热议问题