>SELECT firm.firm_id as Firm_Firm_ID, UPPER(firm.name) as Firm_Name, firm.address as Address, ALLTRIM(firm.city) as City,; > firm.State as State, ALLTRIM(firm.Zip) as Zip, MAX(sro.client) as Client, firm.phone as Phone, firm.fax as Fax,; > MAX(sro.srref) as SRRefNo, sro.sro_id as sro_id, sro.case_id as case_id >FROM Analyzer!sro > JOIN analyzer!firm ON sro.firm_id = firm.firm_id AND > INLIST(sro.sro_status,10,20,30,33,40) AND sro.type = "I" >WHERE &lcSelection >GROUP BY 1, 2, 4, 5, 6, 8 >ORDER BY 2 asc, 4 descend >INTO CURSOR curFirmsWithOrders readwrite > >>As you can see from the results of the sys(3054,12) output below, there's an index on:
>Using index tag Sro_status to rushmore optimize table sro >Using index tag Type to rushmore optimize table sro >Using index tag Case_id to rushmore optimize table sro >Using index tag _del to rushmore optimize table sro >Rushmore optimization level for table sro: full >Using index tag _del to rushmore optimize table firm >Rushmore optimization level for table firm: full >Joining table sro and table firm using index tag Firm_id >>
SELECT firm.firm_id as Firm_Firm_ID, UPPER(firm.name) as Firm_Name, firm.address as Address, ALLTRIM(firm.city) as City,; firm.State as State, ALLTRIM(firm.Zip) as Zip, Client, firm.phone as Phone, firm.fax as Fax,; SRRefNo, sro_id,case_id FROM (SELECT firm_id , MAX(sro.client) as Client , MAX(sro.srref) as SRRefNo , sro.sro_id, sro.case_id FROM Analyzer!sro WHERE sro.sro_status IN (10,20,30,33,40) AND sro.type = "I" AND &lcSelection GROUP BY 1) sro JOIN analyzer!firm ON sro.firm_id = firm.firm_id ORDER BY 2 asc, 4 descend INTO CURSOR curFirmsWithOrders readwrite