Hi Group,

I want to use a UNION in order to SELECT columns from several tables but I wish MySQL 
could use the following syntax:

SELECT {several fields} FROM (Table1 UNION Table2 UNION Table3 ..... ) WHERE condition

Currently I think MySQL only supports the following:

(SELECT {several fields} FROM Table1 WHERE condition) UNION 
    (SELECT {several fields} FROM Table2 WHERE condition) UNION 
        (SELECT {several fields} FROM Table3 WHERE condition) UNION 
            (SELECT {several fields} FROM Table4 WHERE condition)

If the string {several fields} contains like 50 columns and the tables are for 
instance 100, you understand how long the query sent to the server will be (of course 
it works but ....)
For those who did Mathematics, you may be remembering that it is easier to write 10 * 
(20 + 30 + 40 + 50 + 60 + 70 ) 
than writing 10 * 20 + 10 * 30 + 10 * 40 + 10 * 50 + 10 * 60 + 10 * 70


Thanks,
__________________________________
NZEYIMANA Emery Fabrice
NEFA Computing Services, Inc.
P.O. Box 5078 Kigali
Office Phone: +250-51 11 06
Office Fax: +250-50 15 19
Mobile: +250-08517768
Email: [EMAIL PROTECTED]
http://www.nefacomp.net/

Reply via email to