1.SELECT b.no_of_mon,COUNT(*) FROM churn a JOIN month b ON a.no_of_mon=b.no_of_mon WHERE cust_cod NOT IN (SELECT cust_cod FROM churn c WHERE c.no_of_mon<b.no_of_mon) GROUP BY b.no_of_mon;
2.SELECT COUNT(*) FROM churn a,month b WHERE a.no_of_mon=b.no_of_mon andcust_cod NOT IN (SELECT cust_cod FROM churn c WHERE c.no_of_mon<b.no_of_mon group by cust_cod) GROUP BY b.no_of_mon;
problems
1.please tell wheteher the 1 and 2 query are same
2. when i try to execute both of the queries it takes a very long time. how to optmize it?.
no.of rows in the churn table is 1200000