Finding Distinct Value using SQL

后端 未结 3 496
孤独总比滥情好
孤独总比滥情好 2021-01-26 17:11

Show the titles and the award amounts of 20 awards that contain words discover, discoverer, discovery, discovered, and discovering in their abstracts.

My query:

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-26 18:02

    missing '' around discov and ORDER BY and WHERE are inversed:

    SELECT title, count(award) AS count_award, abstract 
      FROM table 
     WHERE abstract LIKE 'discov%'
     GROUP BY title, abstract
     ORDER BY count_award DESC
    LIMIT 20
    

提交回复
热议问题