Ive got a problem with a MySQL query.
Let\'s say, we have two tables:
1......1
2......1
3......1
4......3
GROUP BY didnt help either
Really? Did you try like this?
SELECT id, MAX(qty) AS qty FROM ( SELECT id, qty FROM table1 UNION ALL SELECT id, qty FROM table2 ) T1 GROUP BY id
You can use UNION DISTINCT. Maybe it runs...
SELECT * FROM t1 WHERE ... UNION DISTINCT SELECT * FROM t2 WHERE ...