Re: Joinging two different mySQL result?
| From: | Kim Steinhaug | Date: | Sun, 15 Aug 2004 19:54:29 +0000 |
| Subject: | Re: Joinging two different mySQL result? | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35718@lists.php.net to get a copy of this message | ||
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
-------------------------------------------------------------------------