Hi All
I have the following query
SELECT DISTINCT T_Med.Comp, T_Med.ItemID, T_Med.WP, T_Med.DocName, T_Med.TrfCode, T_Med.CatDescr, T_Med.SubCatDescr, T_LKPWP.RuleCode, T_MedWP.RuleCode, T_Med.Group
FROM (T_Med INNER JOIN T_LKPWP ON (T_Med.DocName=T_LKPWP.SDocName) AND (T_Med.[WP]=T_LKPWP.WP)) LEFT JOIN T_MedWP ON T_LKPWP.RuleCode=T_MedWP.RuleCode
WHERE (((T_MedWP.RuleCode) Is Null));
Because of DISTINCT it takes long time to process. As I found out even though I created indexes for those relevant fields it doesn't help foe DISTINCT. Without DISTINCT same query give results less than one sec
Here T_Med has 1070065 records, T_MedWP has 366315 records and T_LKPWP has 55 records
Is there anyway of achieving the expected results in different way. I tried to create a separate table without DISTINCT, even that took longtime.
Appreciate your comments
Thanks in advance
Cheers
Shabar