select G.region as Region
,A.Name as AgencyName
,A.AgencyId
,sum(L.LoanAmount) as LoanAmount
from dw.FFLoan L
inner join dw.dimborrower B on L.BorrowerId = B.BorrowerId
inner join dw.DIMGeography G on G.GeographyId = B.GeographyId
inner join dw.DIMAgency A on A.AgencyId = L.Agency
group by G.region, A.Name, A.AgencyId
order by Region, LoanAmount desc
查詢我不能夠像 得到輸出首先我想先向東5 5,然後向北和向南,然後再向西。 我需要輸出僅5各頂貸款金額我堅持我有沒有能夠得到合適的輸出
的區域謝謝
請提供期望我們給合適的解決方案 – samar
使用窗函數(ROW_NUMBER)CTE樣本輸入數據和輸出。我正在嘗試一些東西。 – AK47
你給寫4個相同的查詢 – Luv