I got it work for first SUMIFS1(field in excel CG):
--(CG:CG;B:B;B3;CH:CH;1) SELECT ID_Client, SUM(UKIZL_za_SME_RET_CORP_IDX) AS CG FROM RWA_Data_TMP WHERE Related_party_Group = 'N/A' and UKIZL_POVos_SME_RET_CORP_IDX='1.0' GROUP BY ID_Client
But cant figure out second SUMIFS2 (field in excel CI)
--(CG:CG;G:G;G6;CH:CH;1) SELECT Related_party_Group, SUM(UKIZL_za_SME_RET_CORP_IDX) as CG FROM RWA_Data_TMP
*WHERE Related_party_Group <> 'N/A' and UKIZL_POVos_SME_RET_CORP_IDX='1.0' * GROUP BY Related_party_Group
You're going to need a GROUP BY somewhere in the code. You need to use...
SUM(CASE WHEN something = something THEN SomeCol ELSE 0 END).
You probably won't need a WHERE clause at all. You can do all the columns at once. It's known as a CROSS TAB (as opposed to a (ugh!) PIVOT). Here's an article that teaches you all about such things. In later versions of SQL, you can also use SUM(IIF) instead of SUM(CASE).