Tuesday, July 13, 2010

mysql union

mysql> (select 'a') union (select 'a');
+---+
| a |
+---+
| a |
+---+
1 row in set (0.00 sec)

mysql> (select 'a') union all (select 'a');
+---+
| a |
+---+
| a |
| a |
+---+
2 rows in set (0.00 sec)

mysql> (select 'a') union distinct (select 'a');
+---+
| a |
+---+
| a |
+---+
1 rows in set (0.00 sec)

No comments: