时间:2021-07-01 10:21:17 帮助过:68人阅读
查询SQL:SELECT kk.`title`,COUNT(1) times FROM (SELECT `title`, `content` FROM `article` WHERE `content` IN ('aa', 'cc') GROUP BY `title`, `content`) kk GROUP BY kk.`title` HAVING times>=2;CREATE TABLE IF NOT EXISTS `article` ( `id` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(100) NOT NULL, `content` varchar(20) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;INSERT INTO `article` (`id`, `title`, `content`) VALUES(1, 'a', 'aa'),(2, 'a', 'cc'),(3, 'a', 'aa'),(4, 'c', 'cc');
效果估计很差,请大牛指点点