select stuName,stuAge from stuInfo
group by stuName,stuAge
having(count(stuName || stuAge)<2);
但这里不起作用select count(stuName) from stuInfo where stuName='张2';
能查询出3条重复的记录
group by stuName,stuAge
having(count(stuName || stuAge)<2);
但这里不起作用select count(stuName) from stuInfo where stuName='张2';
能查询出3条重复的记录
这样查询一下,相信你一看数据,就知道什么原因了。
select stuName,stuAge,stuName || stuAge,count(stuName || stuAge) from stuInfo
group by stuName,stuAge
having(count(stuName || stuAge)<2);