>INNER JOIN Trans_Insurances TI on curTemp.cTrans_pk = TI.cTrans_fk ; >INNER JOIN Insurances IN on TI.cInsurances_pk = IN.cInsurances_pk ; >INNER JOIN Carrier_Branches CB on IN.cCarrier_Branches_fk = ; >CB.cCarrier_Branches_pk ; >INNER JOIN Carriers on CB.cCarriers_fk = Carriers.cCarriers_pk>
CREATE CURSOR AA (II I) INSERT INTO AA VALUES (0) INSERT INTO AA VALUES (1) INSERT INTO AA VALUES (2) SET NULLDISPLAY TO '?' * 0 1 2 * 1 2 ? * 2 ? ? SELECT * FROM AA A1; LEFT JOIN AA A2 ON A2.II=A1.II+1; LEFT JOIN AA A3 ON A3.II=A1.II+2 * 0 1 ? * 1 2 ? * 2 ? ? SELECT * FROM AA A1; LEFT JOIN AA A2 ON A2.II=A1.II+1; LEFT JOIN AA A3 ON A3.II=A2.II+2 * 0 1 2 SELECT * FROM AA A1; LEFT JOIN AA A2 ON A2.II=A1.II+1; INNER JOIN AA A3 ON A3.II=A1.II+2 * Error SELECT * FROM AA A1; LEFT JOIN (AA A2 INNER JOIN AA A3 ON A3.II=A1.II + 2 ) ON A2.II=A1.II+1 * SELECT * FROM AA A1; LEFT JOIN AA A2 ON A2.II=A1.II+1; INNER JOIN AA A3 ON A3.II=A2.II+2 * 0 ? ? * 1 ? ? * 2 ? ? SELECT * FROM AA A1; LEFT JOIN (AA A2 INNER JOIN AA A3 ON A3.II=A2.II + 2 ) ON A2.II=A1.II+1>Secondly, I may have multiple insurances per Trans. In this case I only want the insurance with max iSequence_Number in my final select.
left join ( ON joincondition and insurance.iSequence_Number ; = (SELECT MAX(iSequence_Number) FROM insurance I WHERE ... )but VFP don't support it.
WHERE TI.pk IS NULL OR IN.iSequence_Number ; IN (select max(iSequence_Number) from Insurances WHERE [the condition for the insurances subset])>
select curTemp.*, padr(nvl(alltrim(Names.cl_name) + ", ","") + ; nvl(alltrim(Names.cf_name) + " ","") + ; nvl(Names.cm_initial,""),50) as cName, ; evl(nvl(Carriers.cShort_Name,padr('NONE',10)),left(Carriers.cCarrier_Name,10)) as cCarrier, ; Client_Product_Lines.cProduct_line ; from curTemp INNER join Names on ; curTemp.cPatients_pk = Names.cPointer_fk ; INNER join Client_Product_Lines ; on curTemp.cClient_Product_Lines_fk = Client_Product_Lines.cClient_product_lines_pk ; LEFT JOIN ; (Trans_Insurances TI; INNER JOIN Insurances IN on TI.cInsurances_pk = IN.cInsurances_pk ; INNER JOIN Carrier_Branches CB on IN.cCarrier_Branches_fk = CB.cCarrier_Branches_pk ; INNER JOIN Carriers on CB.cCarriers_fk = Carriers.cCarriers_pk); on curTemp.cTrans_pk = TI.cTrans_fk ; WHERE TI.???pk IS NULL OR IN.iSequence_Number ; IN (select max(iSequence_Number) from Insurances WHERE [the condition for the insurances subset]); into cursor (m.tcAlias) readwriteI cannot to write the [the condition for the insurances subset]