Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4991
Warning: Creating default object from empty value in /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php on line 4993
Warning: Cannot modify header information - headers already sent by (output started at /www/htdocs/v030397/mysql-qotd/wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php:4991) in /www/htdocs/v030397/mysql-qotd/wp-includes/feed-rss2-comments.php on line 8 Comments on: Question 29: What is the result of the following query?
http://mysql-qotd.casperia.net/archives/242
mysql 5.0/5.1 questions for learning purposesFri, 06 Aug 2010 16:56:36 +0000http://wordpress.org/?v=abchourly1By: urs
http://mysql-qotd.casperia.net/archives/242/comment-page-1#comment-35
ursThu, 25 Feb 2010 16:49:50 +0000http://mysql-qotd.casperia.net/?p=242#comment-35<b>
Answer:
b
<code>UNION</code> will always remove duplicates from the resultset, even if the duplicates aren't the result of the <code>UNION</code>. (like in the example) If you need to have all rows returned, use <code>UNION ALL</code>.
a is actually the output of:
<code>select * from utst1 union all select * from utst2;</code>
</b>
Answer:
b
UNION will always remove duplicates from the resultset, even if the duplicates aren’t the result of the UNION. (like in the example) If you need to have all rows returned, use UNION ALL.
a is actually the output of: select * from utst1 union all select * from utst2;