I am working with a MySQL database. I am suppose to combine three select queries, to "improve performance". Each select below is dependent on the previous ID retrieved.
So far, I've tried the following...
# multiple select from tables
select user.name, group.ID
from user as u, group as g
where u.name = <name_here>
# inner join...
select user.ID, group.ID,
inner join group
on user.ID = group.ID
I don't know if I understand your need, lets try:
Try to use this query:
select pGroupMatch.GroupID, ProfileData.ID from pUserMatch inner join pGroupMatch on pGroupMatch.GroupID = pUserMatch.GroupID inner join ProfileData on ProfileData.id = pGroupMatch.ProfileID where pUserMatch.username = "<username>";
Check if you can create indexes for improve your query, if you can try it:
CREATE INDEX idx_pUserMatch_01 ON pUserMatch (GroupID); CREATE INDEX idx_pGroupMatch_01 ON pGroupMatch (ProfileID);