Getting Error while execution of the query
Posted: Mon Jul 14, 2008 1:06 am
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.
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 =
and ht.month = 3 and ht.year =
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.