mysql - how to write query with joins -
How can I query this in a query? Can we use joining? "GroupID" as SELECT id, parentID, name FROM (SELECT GroupActivities.groupID, groupActivities.id) as "activityID" from GroupActivities Group Group ID) anon_4, group WHERE Groups.id = anon_4.groupID by order anon_4.activityID DESC
We have two tables: 1) Group: ID, parent, column as the name 2) Group activitivity : Column id, group id
I'm not sure what you try to get from that query Are you, give an answer Will shout A join can be used in that situation, but I can not see how it will give any benefit to you (technically, I think you are already using a form of joining there) .
If I understand your query correctly, you are trying to get some basic information about each group, while ordering them in descending order, the maximum group acquittances Am i right OK, because you need a max from another table, so I do not see a way to avoid a selective precaution. It is being said, this is my solution (it is difficult to say that it is better than you, maybe some SQL teachers around here can tell us who performs better):
SELECTg ID, G.PRIIDID, G.E.D Group as a G Order (Group Maximity to Select Max (GED) GAAHEAAEGAGroupID = G.ID) DESC;
Comments
Post a Comment