Hello All, I'me using MaxDb 7.6.00.32 on Windows 2000 Server. I've a strange problem with subqueries. This query work fine: select distinct article.art_c_ref from torpedo.article,torpedo.niv_clfct_mar as metier,torpedo.niv_clfct_mar as famille where exists (select * from torpedo.encours_sto_art where torpedo.encours_sto_art.Art_c_ref = torpedo.article.art_c_ref and torpedo.encours_sto_art.sto_c_code = '2ANGE' and torpedo.encours_sto_art.ESA_F_STOTHEO > 0) and art_l_actif = true and article.art_c_ref = metier.art_c_ref and metier.cm_i_num = 1 and metier.cm_i_rang = 2 and metier.cm_c_code = '50' and article.art_c_ref = famille.art_c_ref and famille.cm_i_num = 1 and famille.cm_i_rang = 3 and famille.cm_c_code = '010' and article.art_c_type_ens = '0' and article.art_c_ref not in(select art_c_ref from torpedo.etb_int where torpedo.etb_int.etb_c_code = 'ANGE') and article.art_c_ref not in (select art_c_ref from torpedo.sku where torpedo.sku.col_c_code = 'EXO')
But this one return an error: select distinct article.art_c_ref from torpedo.article,torpedo.niv_clfct_mar as metier,torpedo.niv_clfct_mar as famille where exists (select * from torpedo.encours_sto_art where torpedo.encours_sto_art.Art_c_ref = torpedo.article.art_c_ref and torpedo.encours_sto_art.sto_c_code = '2ANGE' and torpedo.encours_sto_art.ESA_F_STOTHEO > 0) and art_l_actif = true and article.art_c_ref = metier.art_c_ref and metier.cm_i_num = 1 and metier.cm_i_rang = 2 and metier.cm_c_code = '50' and article.art_c_ref = famille.art_c_ref and famille.cm_i_num = 1 and famille.cm_i_rang = 3 and famille.cm_c_code = '010' and article.art_c_type_ens = '0' and article.art_c_ref not in(select art_c_ref from torpedo.etb_int where torpedo.etb_int.etb_c_code = 'ANGE' union select art_c_ref from torpedo.sku where torpedo.sku.col_c_code = 'EXO') General error;-7011 POS(241) Correlated subquery not allowed ...torpedo.encours_sto_art.Art_c_ref = torpedo.article.art_c_ref... Why does the error is on the first subquery, since I've change the last one ? TIA Fred. P.S. I know I can do more optimisation on the query, but it's generated by an application, depending on which criteria are chosen by the user. P.P.S sorry for my poor English, French native ;) -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]