I am working on a SQL query that will return data in the following format
The record set defines a company, the amount of female employees, and the amount of male employees. Currently this is my query which returns the number of male employees
SELECT tusers.company, count(tclassextenddata.baseid)
INNER JOIN tclassextenddatauseractivity AS tclassextenddata
ON tclassextenddata.baseid = tusers.userid
INNER JOIN tclassextendattributes
ON tclassextenddata.attributeid = tclassextendattributes.attributeid
WHERE tusers.subtype = 'Student'
AND tclassextendattributes.name = 'gender'
AND tclassextenddata.attributevalue = 'Female'
AND tusers.inactive = 0
GROUP BY company
This is from a CMS engine so it isn't the best means of database layout, but I can't change it.