从titles表获取按照title进行分组

题目描述

从titles表获取按照title进行分组,每组个数大于等于2,给出title以及对应的数目t。
CREATE TABLE IF NOT EXISTS "titles" (
`emp_no` int(11) NOT NULL,
`title` varchar(50) NOT NULL,
`from_date` date NOT NULL,
`to_date` date DEFAULT NULL);
select title,count(title) as t
from titles 
group by title
having count(title) >=2;


猜你喜欢

转载自blog.csdn.net/reticent_man/article/details/80822454
今日推荐