MySQL Forums
Forum List  »  Optimizer & Parser

Query multiple table
Posted by: prem budhu
Date: March 29, 2009 05:14PM

Hello,
I need some help on how to construct a query for Hugh multiple tables.

Table (1))
------------
Index,CallA,CallB

Table (2)
----------------
Index, call,message

Table (3)
------------------
Index ,call , message


In table1 CallA will exist in table2 or table 3. Similarly, CallB will exist in table2 or table3

I would like to build a query that select all the element in table1 where CallA exist in table2 or table3 or CallB exist in table2 or table3 and table1.message = 'ok' or table2.message = 'ok'

Here is my query but it take a very long time to execute. Can you help me optimize it

select table1.*
from table1,table2,table3
where table1.callA = table2.call
or table1.callA = table3.call

or table1.CallB =table2.call
or table1.call= table2.call

and (table1.message ='ok' or table2.message='ok')

Options: ReplyQuote


Subject
Views
Written By
Posted
Query multiple table
6697
March 29, 2009 05:14PM
2555
March 30, 2009 07:16PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.