Skip to content
Advertisement

Count Male and Female in SQL and how many records are there. With male listed with their name

I have a table Company, and I want to group the entries by Male and Female.

And I want their names listed in a column.

The result should like as shown here:

I got the count of the male and female, but I also need the names in a single column

Advertisement

Answer

Try This but please keep in mind that STRING_AGG is not available on every DBMS system

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement