The Little Guy Posted August 10, 2008 Share Posted August 10, 2008 Why is this only returning 5 results? It should return 6. The second select returns two rows count of "males" and count of "females". When run individually they all return the correct results. (SELECT COUNT(id) AS count FROM users) UNION (SELECT COUNT(id) as count FROM users GROUP BY gender) UNION (SELECT COUNT(id) as count FROM images) UNION (SELECT COUNT(id) as count FROM videos) UNION (SELECT COUNT(id) as count FROM events) UNION (SELECT COUNT(id) as count FROM leagues) Quote Link to comment Share on other sites More sharing options...
toplay Posted August 10, 2008 Share Posted August 10, 2008 UNION by default removes any duplicates from the results. So, use UNION ALL if you want dups returned. Quote Link to comment 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.