SELECT * FROM 表名 W WHERE EXISTS(SELECT 姓名,性别 FROM 表名 WHERE 姓名=W.姓名 AND 性别=W.性别 GROUP BY 姓名,性别 HAVING COUNT(*)>1) ORDER BY 姓名,性别
select * from tab where Name like '张%'and sex='女'