|
SELECT Distinct_AlternateKey.AlternateKey2, Mid([AlternateKey2],6,8) AS Agent, Mid([AlternateKey2],14,3) AS Class, IIf(Mid([AlternateKey2],14,3)='MOT','MOTOR','NON-MOTOR') AS MainClass, Sum([GWP_Table].[Month07]) AS GWP_Nov, Sum([RWP_Table].[Month07]) AS RWP_Nov, Sum([GEP_Table].[Month07]) AS GEP_Nov, Sum([REP_Table].[Month07]) AS REP_Nov, Sum([GWC_Table].[Month07]) AS GWC_Nov, Sum([RWC_Table].[Month07]) AS RWC_Nov, Sum([GLP_Table].[Month07]) AS GLP_Nov, Sum([RLP_Table].[Month07]) AS RLP_Nov, Sum([GOL_Table].[Month07]) AS GOL_Nov, Sum([ROL_Table].[Month07]) AS ROL_Nov
FROM (((((((((Distinct_AlternateKey LEFT JOIN Sds_agent AS GEP_Table ON Distinct_AlternateKey.GEP_Key = GEP_Table.AccumAcct) LEFT JOIN Sds_agent AS REP_Table ON Distinct_AlternateKey.REP_Key = REP_Table.AccumAcct) LEFT JOIN Sds_agent AS GWC_Table ON Distinct_AlternateKey.GWCKey = GWC_Table.AccumAcct) LEFT JOIN Sds_agent AS RWC_Table ON Distinct_AlternateKey.RWCKey = RWC_Table.AccumAcct) LEFT JOIN Sds_agent AS GLP_Table ON Distinct_AlternateKey.GLPKey = GLP_Table.AccumAcct) LEFT JOIN Sds_agent AS GWP_Table ON Distinct_AlternateKey.GWPKey = GWP_Table.AccumAcct) LEFT JOIN Sds_agent AS RWP_Table ON Distinct_AlternateKey.RWPKey = RWP_Table.AccumAcct) LEFT JOIN Sds_agent AS RLP_Table ON Distinct_AlternateKey.RLPKey = RLP_Table.AccumAcct) LEFT JOIN Sds_agent AS GOL_Table ON Distinct_AlternateKey.GOLKey = GOL_Table.AccumAcct) LEFT JOIN Sds_agent AS ROL_Table ON Distinct_AlternateKey.ROLKey = ROL_Table.AccumAcct
GROUP BY Distinct_AlternateKey.AlternateKey2, Mid([AlternateKey2],14,3), IIf(Mid([AlternateKey2],14,3)='MOT','MOTOR','NON-MOTOR'), Mid([AlternateKey2],9,5)
HAVING (((Mid([AlternateKey2],17,2))<>''))
ORDER BY Mid([AlternateKey2],9,5);
你们觉得有问题吗??
是可以RUN, 但
GWP_NOV,RWP_NOV...... 等等, VALUE 是 NULL。。。。 |
|