我需要选择gno中所有重复一次的事件,也就是说,我需要能够选择1001在这种情况下,我该怎么做?
create table project99
(
pno int primary key,
projtitle varchar2(30),
projarea varchar2(30),
startd date,
gno int references guide99(gno)
);
insert into project99 values(1,'E Commerce website','php','03-jan-2016',1001);
insert into project99 values(2,'Web forums','php','05-jan-2016',1001);
insert into project99 values(3,'Sudoku','C','06-jan-2016',1002);
insert into project99 values(4,'Student management System','php','04-jan-2016',1003);
insert into project99 values(5,'Antivirus','System','04-jan-2016',1004);
insert into project99 values(6,'Snake','C++','03-jan-2016',1004);
insert into project99 values(7,'Library management','php','03-jan-2016',1006);
insert into project99 values(8,'Video Sharing website','C#','03-jan-2016',1005);
insert into project99 values(9,'Search Algorithm','maths','03-may-2016',1010);
insert into project99 values(10,'Email','php','03-jan-2016',1007);
最佳答案
SELECT gno
FROM project99
GROUP BY gno
HAVING COUNT(1) > 1;
关于mysql - 选择多次出现的特定列数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40181026/