Reputation: 170
I have got an employee master table where I have field named 'Gender'. I want to select total 10 records from employee master table where I should get 5 records of Gender as Male and 5 records of Gender as Female. How can i do this?
Upvotes: 0
Views: 39
Reputation: 172438
You can try like this:
select * from employee where Gender = 'Male' LIMIT 5
UNION ALL
select * from employee where Gender = 'Female' LIMIT 5;
Upvotes: 2