"Bruno Batarelo" <[EMAIL PROTECTED]> wrote:
> I have a problem to report. There is a SELECT query that selects data from
> three tables according to certain criteria. It goes like this:
> 
> SELECT bglavna.T001, bpolja.ID AS ID2, bpotpolja.TEKST
> FROM (bglavna INNER JOIN bpolja ON bglavna.ID=bpolja.FK) INNER JOIN
> bpotpolja ON bpolja.ID=bpotpolja.FK
> 
> WHERE bpolja.TAG = '200' AND bpotpolja.SUBF = 'a' AND bglavna.ID IN (...);
> 
> "..." is replaced by a subquery that works perfectly and goes like this:
> 
> SELECT bglavna.ID FROM (bglavna INNER JOIN bpolja ON bglavna.ID = bpolja.FK)
> INNER JOIN bpotpolja ON bpolja.ID = bpotpolja.FK WHERE bpolja.TAG = '700'
> AND bpotpolja.SUBF = 'a' AND bpotpolja.TEKST = 'kishon'
> 
> As it can be seen, two very similar queries executed on same tables.
> Subquery works perfectly and gives the results immediately. But when i put
> it in the first query, disk activity does not stop at all and I need to kill
> the process. Then I execute subquery, gather results and separate them with
> comma(", ") and put them in the first query and everything works perfectly.
> So, first query works good when results are explicitly given, and second
> query works fine all the time, but when I join them together, everything
> stops functioning. I indexed almost every column but it did not help. These
> kind of queries allways worked, I don't know what could have happened. Every
> sugestion is highly appreciated.

Could you send tables stuctures and probably some data for testing?


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to