Page 1 of 1
union not allowed
Posted: Fri Jan 17, 2003 3:12 am
by jeiman
I have 3 tables where I want to search a result in both 3 tables. The problem is I just realize my MySql version 3, not allowed me to use UNION syntax. Is there any other way where I can get the result as same as UNION without using UNIon command??
Any help please..
Posted: Fri Jan 17, 2003 9:03 am
by LM
You can use tree select queries.
If you need a specific order you can insert the results of the tree queries in a temporary table and perform a select on this temporary table.
Posted: Sat Jan 18, 2003 2:08 am
by jeiman
Thanks LM,
But then I don't really know the tree select query. Can you show me how. My 3 tables are products, specifications and companies. My query using UNION is:
$word_var = "% any_words %";
"SELECT id, name FROM specifications
WHERE name LIKE '" . $word_var . "'
OR description LIKE '" . $word_var . "'
UNION
SELECT id, name FROM products
WHERE name LIKE '" . $word_var . "'
OR overview LIKE '" . $word_var . "'
UNION
SELECT id, name FROM companies
WHERE name LIKE '" . $word_var . "'
OR info LIKE '" . $word_var . "'
OR address LIKE LIKE '" . $word_var . "' ";
Can you please convert that query into tree select query. Your help is really appreciated. Thank you