Qe : 1)
select
a.finishproductid
from
tblt_invoiceorderitems a, tblm_invoiceorder b
where
b.invoiceorderdate <= 'Current Date' and
a.invoiceorderid = b.invoiceorderid
— it has more than 16k records.
Qe : 2 )
select jobcardid, stockcode
from tblm_finishproduct
where productionentrydate <= 'Current Date'
— it has also more than 16k Record.
Now i Want From 2nd Query not in first query.
select jobcardid, stockcode
from
tblm_finishproduct
where
productionentrydate <= 'CurrrntDate' and
finishproductid not in
(
select
a.finishproductid
from
tblt_invoiceorderitems a, tblm_invoiceorder b
where
b.invoiceorderdate <= 'CurrrntDate' and
a.invoiceorderid = b.invoiceorderid
);
Now its taking a time
This does not address your question, but you should not be using
a.invoiceorderid = b.invoiceorderidin your where clause–try this query in place of the first one. Natural join is more efficient than making a cross product of the entire table and selecting only those rows that match.