SELECT T1.CARMODELPKID,COUNT(1) FROM RT_CUSTALLOCRESULT T LEFT JOIN VM_CARINFO T1 ON T1.FRAMENO = T.FRAMENO LEFT JOIN RT_CUSTFOLLOWUP T2 ON T2.REGNO = T.REGNO WHERE T1.CARMODELPKID IS NOT NULL AND T2.DEFEATREASON IS NOT NULL GROUP BY CARMODELPKID
SELECT T1.CARMODELPKID,COUNT(1) FROM RT_CUSTALLOCRESULT T LEFT JOIN VM_CARINFO T1 ON T1.FRAMENO = T.FRAMENO LEFT JOIN RT_CUSTFOLLOWUP T2 ON T2.REGNO = T.REGNO WHERE T1.CARMODELPKID IS NOT NULL AND T2.DEFEATREASON IS NOT NULL GROUP BY CARMODELPKID