I don't know how to explain this very well, but how do I select certain fields from different tables using a join query? For example:
But suppose, instead of everything, I just want the following fields:
users.userid
users.name
groups.groupid
groups.groupname
If it were just the first 2 fields, I could say users.userid, users.name instead of *, but I don't know how to do it for the second table. can anybody help me at all?
Code:
SELECT * FROM users LEFT JOIN usersingroups USING (userid) LEFT JOIN groups USING (groupid) WHERE groups.group_type = 'type1'
But suppose, instead of everything, I just want the following fields:
users.userid
users.name
groups.groupid
groups.groupname
If it were just the first 2 fields, I could say users.userid, users.name instead of *, but I don't know how to do it for the second table. can anybody help me at all?