Below query running very slow...
select COUNT(1) from [bts_mst]
inner JOIN [BTS_Retailermapping_mst] on [bts_mst].BTSID=[BTS_Retailermapping_mst].SAM_ID
inner JOIN KPI_Transaction_Inbound on Retailer_MDN =BTS_Retailermapping_mst.RETAILER_EVD_NO
where bts_mst.Distributor_Id= '974165' and bts_mst.BTSID='S_KL_PRNM_3' AND (KPI_Transaction_Inbound.ACTT_MTD>0.00)
AND KPI_Transaction_Inbound.ID=(select max(ID) from KPI_Transaction_Inbound
where Retailer_MDN =BTS_Retailermapping_mst.RETAILER_EVD_NO)
Record count Below table
bts_mst---->99059
BTS_Retailermapping_mst---->687422
KPI_Transaction_Inbound------>7759078
Please help as early as possible...