1、案例
create TABLE if not EXISTS `article`( `id` int(10) UNSIGNED not null primary key auto_increment, `author_id` int(10) UNSIGNED not null, `category_id` int(10) UNSIGNED not null, `views` int(10) UNSIGNED not null, `comments` int(10) UNSIGNED not null, `title` VARCHAR(255) not null, `content` TEXT not null ); INSERT into `article`(`author_id`,`category_id`,`views`,`comments`,`title`,`content`) VALUES (1,1,1,1,'1','1'), (2,2,2,2,'2','2'), (1,1,3,3,'3','3'); #查询category_id 为1 且comments 大于1 的情况下,views最多的情况下的article_id。 create TABLE if not EXISTS `article`