表keyword
字段
id
keyword
jid
例如一个jid是123的招聘信息出现三个关键词
那么就插入三条记录
id keyword jid
1 oop 123
2 mysql 123
3 接口 123
如何按照keyword出现的总量按照降序排列呢
1
jookr OP 得到的结果是
keyword count oop 999 mysql 800 接口 100 |
2
jookr OP 其实就是N多个语句拼成一句来写
SELECT count(*) FROM `table` where `keyword` = 'oop' SELECT count(*) FROM `table` where `keyword` = 'mysql' SELECT count(*) FROM `table` where `keyword` = '接口' 。。。 按照各自得出的count数量降序排列 |
3
jybox 2015-03-10 14:32:02 +08:00
GROUP BY
|
4
binjoo 2015-03-10 14:32:16 +08:00 1
```sql
select keyword, count(*) as c from table group by keyword order by c desc ``` |
5
mhycy 2015-03-10 14:33:13 +08:00
SELECT count(*) as count FROM table GROUP BY keyword ORDER BY count DESC
|
6
jookr OP |