J.,
Monday, November 18, 2002, 12:32:35 PM, you wrote:

JCO> Try this:

JCO> mysql> CREATE TABLE a (
JCO>   id int NOT NULL PRIMARY KEY,
JCO>   des varchar(20) default NULL
JCO> );
JCO> Query OK, 0 rows affected (0.00 sec)

JCO> mysql> INSERT INTO a VALUES (1,'pepe'),(2,'juan'),(3,'mariano');
JCO> Query OK, 3 rows affected (0.00 sec)
JCO> Registros: 3  Duplicados: 0  Peligros: 0

JCO> mysql> select NULL as id, des
JCO>     -> from a
JCO>     -> union
JCO>     -> select id, des
JCO>     -> from a;
JCO> +------+---------+
JCO> | id   | des     |
JCO> +------+---------+
JCO> | NULL | pepe    |
JCO> | NULL | juan    |
JCO> | NULL | mariano |
JCO> |      | pepe    |
JCO> |      | juan    |
JCO> |      | mariano |
JCO> +------+---------+
JCO> 6 rows in set (0.00 sec)

JCO> Is this OK? I think that no.

It's OK. The first SELECT in the UNION sets type for all
SELECTs in the UNION. NULL says not so match about column type.

JCO> Then try this:
JCO> mysql> select id, des
JCO>     -> from a
JCO>     -> union
JCO>     -> select NULL as id, des
JCO>     -> from a;
JCO> +----+---------+
JCO> | id | des     |
JCO> +----+---------+
JCO> |  1 | pepe    |
JCO> |  2 | juan    |
JCO> |  3 | mariano |
JCO> |  0 | mariano |
JCO> +----+---------+
JCO> 4 rows in set (0.00 sec)

JCO> Is this OK? Again, I think that no.

It's not OK and already fixed. Thanks for report!



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to