The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay

The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay


if you have long mysql query or many joins and you got this error the use this 

SET SQL_BIG_SELECTS=1


example: 
SELECT p.id as project_id,  p.job_number, p.time_to_complete , p.user_id, p.job_name, p.bid_date , p.bid_complete_date, p.service_id, p_docs.link, p_docs.username, p.status,  p_docs.password, p_docs.special_instructions, ord.amount, ord.payment_status, p.createDate , s.service_name
, u.contact_name , u.f_number , f.name as franchise_name , v.name as vendor_name ,v.id as vendor_id ,
s.id as services_id , ord.order_date
FROM wte_projects AS p

INNER JOIN wte_projects_docs AS p_docs ON p.id = p_docs.project_id
INNER JOIN wte_orders AS ord ON p.id = ord.project_id
INNER JOIN wte_users AS u ON u.id = p.user_id 
LEFT JOIN wte_franchise as f on f.code = u.f_number

LEFT JOIN wte_services AS s ON s.id = p.service_id
LEFT JOIN wte_vendor AS v ON v.id = p.vendor_id WHERE 1=1 AND ord.payment_status = 'paid' " ;


where You are running your query before the code of your query paste this code before you query executing


 mysql_query("set sql_big_selects=1");


now run the fine it works!

Comments

  1. Really nice ....

    it's working

    thanks a lot
    Vishwas kumar

    ReplyDelete

Post a Comment