I have this query:
SELECT DISTINCT id,
label
FROM bbproduct_cust
WHERE CUSTNO IN (SELECT CUSTNO
FROM customer
WHERE SLSRPTGRP = '1996')
AND DEPTNO = '0'
ORDER BY label ASC
EXPLAIN
shows
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY bbproduct_cust ALL ind_deptno 91834 Using where; Using temporary; Using filesort
2 DEPENDENT SUBQUERY customer ref PRIMARY,ind_slsrptgrp ind_slsrptgrp 3 const 4 Using where
it takes 2-3 seconds, and I need it optimized.
What options I have?