[Err] 1104 - The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=
Hello all,
I get this error running query (with 2 or 3 JOINS) but not so biiiiiig.
How can I fix this in DB2?
Someone suggests to add SET SQL_BIG_SELECTS=1; before running the query.
Where I'm supposed to put this code if I have this query?
<?php
$rs_storico_ritiri = new WA_MySQLi_RS("rs_storico_ritiri",$conn_registrazione_i,10);
$rs_storico_ritiri->setQuery("SELECT pickup_obi.*, tipologia_ritiri_trit.*, store_mittente.name_sto AS store_mittente, store_destinazione.name_sto AS store_destinazione FROM pickup_obi LEFT JOIN tipologia_ritiri_trit ON pickup_obi.ritiro_tipologia_obi = tipologia_ritiri_trit.id_trip INNER JOIN stores_sto AS store_mittente ON store_mittente.number_sto = pickup_obi.store_mittente_obi LEFT JOIN stores_sto AS store_destinazione ON store_destinazione.number_sto = pickup_obi.store_destinazione_obi WHERE pickup_obi.data_ritiro_obi <= CURDATE() AND pickup_obi.store_mittente_obi = ? ORDER BY pickup_obi.data_ritiro_obi DESC");
$rs_storico_ritiri->bindParam("i", "".$_SESSION['sess_number_sto'] ."", "-1"); //colname
$rs_storico_ritiri->execute();
?>
Please note that if I add this code to a database client as Navicat it works.
But I don't know where to put this code in dreamweaver in the webasssist mysqli recordset code.
I tried this:
<?php
$rs_storico_ritiri = new WA_MySQLi_RS("rs_storico_ritiri",$conn_registrazione_i,10);
$rs_storico_ritiri->setQuery("SET SQL_BIG_SELECTS=1; SELECT pickup_obi.*, tipologia_ritiri_trit.*, store_mittente.name_sto AS store_mittente, store_destinazione.name_sto AS store_destinazione FROM pickup_obi LEFT JOIN tipologia_ritiri_trit ON pickup_obi.ritiro_tipologia_obi = tipologia_ritiri_trit.id_trip INNER JOIN stores_sto AS store_mittente ON store_mittente.number_sto = pickup_obi.store_mittente_obi LEFT JOIN stores_sto AS store_destinazione ON store_destinazione.number_sto = pickup_obi.store_destinazione_obi WHERE pickup_obi.data_ritiro_obi <= CURDATE() AND pickup_obi.store_mittente_obi = ? ORDER BY pickup_obi.data_ritiro_obi DESC");
$rs_storico_ritiri->bindParam("i", "".$_SESSION['sess_number_sto'] ."", "-1"); //colname
$rs_storico_ritiri->execute();
?>
But it doesn't work and I get this error "There is an error in your SQL syntax.".
TIA
tony