I am having problem in joint two subqueries in MySQL, e.g.
(select * from table1 where id = 1 group by f1) a1
join
(select * from table2 where id = 2 group by f2) a2 ON a1.f3 = a2开发者_运维技巧.f3;
ERROR 1064 (42000): 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 'join (select * from table1 where id = 2)' at line 1
Is my syntax incorrect?
Check out some examples
SELECT * FROM table1, table2;
SELECT * FROM table1 INNER JOIN table2 ON table1.id=table2.id;
SELECT * FROM table1 LEFT JOIN table2 ON table1.id=table2.id;
SELECT * FROM table1 LEFT JOIN table2 USING (id);
精彩评论