* Elisenda
[...]
> So, the good way to write joins will be as follows, doesn't it?
>
> FASE.SQL_ID_CE=CA.CA_ID_CE AND
> FASE.PR_PP_ID_COORD=PP.PP_ID_PP AND
> CA.CA_ID_CE=CE.CE_ID_CE AND
> FASE.AU_PR_AULA=AU.AU_AULA

Those are the exact same criteria as you had, only in a different order,
isn't it? The order of these criteria within the WHERE clause does not
matter, the server will select the optimal way to join, which is what is
expressed in the EXPLAIN SELECT output. You also changed
CE.CA_ID_CE=CA.CE_ID_CE to CA.CA_ID_CE=CE.CE_ID_CE, this is the same thing,
it makes no difference.

[...]
> So, when explain select  says this
> "CE     ref   Centro      7        CA.CA_ID_CE            10" ,
> it isn't a good result for me, isn't it?

That depends...

> Because CA it is supposed to have one record for each CE or the other way
> round.

...then it is not good. You would have expected a 1 in the last column.

> I have to review CA and CE.

yes. :)

[...]
> > I don't understand... How many FASE records with PR_flag=1 and
> > SQL_ID_PY='P081'? You say when you join FASE and CA on those
> > criteria you get 253 rows, but you should get 753?
>
> I mean that in my database I have 753 records that match this critera
> (SQL_ID_PY=P081 and PR_flag=1 and CA_ID_Idioma=6) but the result of mysql
> gives me only 253.

I still don't get it. When you say "in my database", which database are you
talking about? How do you know you have 753 when mysql (=database?) says you
have 253? And what do you mean by "records that match", the CA_ID_Idioma
column is from a different table, isn't it?

[...]
> Thank you very much for your help and patients.

You're welcome. :)

--
Roger


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

Reply via email to