MrXHellboy Posted June 8, 2011 Share Posted June 8, 2011 Hello, This query seems to only receive the result from the first SELECT statement, and it doesnt add the COUNT() amounts together. (SELECT a_LEV_NR, COUNT(DISTINCT ASN_ORDER), COUNT(ASN_ORDER), a_LEVER_WEEK FROM qty_discrepancies GROUP BY a_LEV_NR) UNION ALL (SELECT a_LEV_NR, COUNT(DISTINCT ASN_ORDER), COUNT(ASN_ORDER), a_LEVER_WEEK FROM tht_tgt_discrepancies GROUP BY a_LEV_NR) Could someone help me out ? Quote Link to comment https://forums.phpfreaks.com/topic/238829-union-all/ Share on other sites More sharing options...
requinix Posted June 8, 2011 Share Posted June 8, 2011 There isn't any addition in there. MySQL will execute both queries return the results concatenated together. 1 UNION ALL 2 = 1 and 2, not 3. Quote Link to comment https://forums.phpfreaks.com/topic/238829-union-all/#findComment-1227173 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.