Thanks for the help Mike.
A temp table could definately be an option. although I've tried working with temp tables in MySQL before, but had a lot of trouble with them. It just seems like creating a tmp table would be a little overkill. I am really looking for a simpler solution, but if there is no other...
anyone have any more ideas???
thanks
Mike Quinn wrote:
Hi Max,
Sorry about that, I use Oracle a lot and forget what is missing from MySQL at times.
I found this in the docs under 3.5.7
For the moment you can solve this very efficiently by using a TEMPORARY table. This type of optimization is also very good if you are using very complicated queries where the SQL server does the optimizations in the wrong order.
CREATE TEMPORARY TABLE tmp
SELECT field1_index, field2_index FROM test_table WHERE field1_index = '1';
INSERT INTO tmp
SELECT field1_index, field2_index FROM test_table WHERE field2_index = '1';
SELECT * from tmp;
DROP TABLE tmp;
The above way to solve this query is in effect an UNION of two queries.
maybe a possibility?
Mike