Hi,
I have two separate SELECT statements which are both GROUP-BY'd separately e.g.:
SELECT x, y, z FROM a GROUP BY x
SELECT x, n, o FROM b GROUP BY x
I would very much like to JOIN these two SELECTs together to combine their columns, such as:
SELECT x as x1, y, z FROM a GROUP BY x
LEFT JOIN (
SELECT x as x2, n, o FROM b GROUP BY x)
ON x1=x2;
Is this possible? I ask because MySQL is complaining
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN SELECT x as x2
If this is possible, any thoughts on what's wrong with my syntax?
Thanks very much!