I've been having some difficulty with a query. What I have are two tables(irrelevant data omitted):
students(SID, career) where career is either "ugrd" or "grd",
memberof(studentid, groupname)
SELECT "GROUPNAME" FROM "MEMBEROF"
INNER JOIN "STUDENT" //to get rid of students not in a group
ON "SID" = "STUDENTID"
GROUP BY "GROUPNAME" //so that no duplicates are listed
this is the code I have that works so far but it only lists groups that have students in them. I need a query that can list groups with more "GRD" students than "UGRD", but I am unsure how to go about comparing the number of undergrads vs. grads in each group and selecting the groups with more grads.
So far, I have tried working with the count function but have been unable to figure out a way to manipulate it in a way that would answer the problem. I really want to understand how to get the results I need as well as how it works. If anyone could help, i'd really appreciate it. Thanks.