Hi list,

The following sql statement takes 3 mintues to complete the query. How can I improve its speed?
select DISTINCT i.basename from inventory i, transaction t, customer c where i.prodcode = t.prodcode and c.custcode = t.custcode and i.basename is not NULL and i.prodname is not NULL and ((date(t.date) >= "2004-01-01" and date(t.date) <= "2004-01-31") and i.basename IN (select DISTINCT ii.basename from inventory ii, transaction tt, customer cc where ii.prodcode = tt.prodcode and cc.custcode = tt.custcode and ii.basename is not NULL and ii.prodname is not NULL and(date(tt.date) >= "2005-01-01" and date(tt.date) <= "2005-01-31"))) order by i.basename


Thanks
Sam


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to