Re: Joinging two different mySQL result?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hehe,

I ended up with a mile long sql query since I had to do some smart
setup to make all tables work in the UNION. To distinquish between
from where the data came from I did this

Example (Look at the fromtable)

(SELECT id, name, 0 as fromtable FROM table1 where blabla)
UNION
(SELECT id, company as name, 1 as fromtable FROM blabla)
UNION
(SELECT id, name, 2 as fromtable FROM blabla)

Its not an optimal query thats for sure, but it makes the PHP code
10 times easier and the result is just marvelous.

To think that I forgot all abou the UNION command, a shame, :D

-- 
Kim Steinhaug
-------------------------------------------------------------------------
There are 10 types of people when it comes to binary numbers:
those who understand them, and those who don't.
-------------------------------------------------------------------------
www.steinhaug.com - www.easywebshop.no - www.easycms.no www.webkitpro.com
-------------------------------------------------------------------------

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux