How about this sql.
Create table Tbl_SQL_Test
(
PersonId Int,
PesonName Varchar(20),
GenderVarchar(10)
)
Insert into Tbl_SQL_Test
select 1, 'babu','Male'
union
select 2,'Subu','male'
union
select 3,'jothi','female'
union
select 4,'srinithi','female'
select A.PesonName,B.PesonName from Tbl_SQL_Test A cross join Tbl_SQL_Test B
Where A.PesonName <> B.PesonName
and A.Gender <> b.Gender
and a.Gender = 'Male'
order by A.PesonName