sukhpreet_ahluwalia Posted July 15, 2008 Share Posted July 15, 2008 i got this error: ERROR 1104: The SELECT would examine too many records and probably take a very long time. Check your WHERE and use SET OPTION SQL_BIG_SELECTS=1 if the SELECT is ok. I used set sql_big_select= 1; statement before the query. But still the problem is continuing. Query is such that there are four tables feeder,sentout,ht and lt... now in feeder and sentout the fields feeder_code and subdivision_code combination row is unique...But in the ht and lt tables the feeder and can have combination with different subdivisions which is now not fixed..Now i want resultset and feeder_code and subdivision.. having all the combination in the four tables... Query is as below ---------------- SELECT distinct f.feeder_code ,f.subdivision_code from feeder as f,sentout as sot,ht,lt where (f.feeder_code = lt.feeder_code and f.subdivision_code = lt.subdivision_code and lt.month = 4 and lt.year = or (f.feeder_code = ht.feeder_code and f.subdivision_code = ht.subdivision_code and ht.month = 3 and ht.year = or (f.feeder_code = sot.feeder_code and f.subdivision_code = sot.subdivision_code and sot.month = 3 and sot.year = UNION (SELECT distinct lt.feeder_code ,lt.subdivision_code from feeder as f,lt where lt.feeder_code != f.feeder_code and lt.subdivision_code != f.subdivision_code and lt.month = 4 and lt.year = UNION (SELECT distinct ht.feeder_code ,ht.subdivision_code from feeder as f,ht where ht.feeder_code != f.feeder_code and ht.subdivision_code != f.subdivision_code and ht.month = 3 and ht.year = 8 ) order by feeder_code,subdivision_code Plz help me as soon as possible. I have to solve the issue at earliest. Link to comment https://forums.phpfreaks.com/topic/114789-error-1104-comes-while-executing-the-query/ Share on other sites More sharing options...
fenway Posted July 15, 2008 Share Posted July 15, 2008 year = <nothing> looks a bit funny all those ORs aren't great either, especially without proper JOINs neither are those != Link to comment https://forums.phpfreaks.com/topic/114789-error-1104-comes-while-executing-the-query/#findComment-590521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.