tsql

How to create pivot using sql

删除回忆录丶 提交于 2020-11-29 19:35:15
问题 I am new to SQL, I have a table like this. Below is the query : select gc.GC_Name, dt.GC_SectorType, dt.ageing, sum(cast(dt.[Brokerage Debtors] as numeric)) as Brokerage_Amt, dt.divisionalofficename from [AR].[Fact_Brokerage_Debt] dt inner join AUM.DIM_BUSINESS_TYPE BT on BT.Business_Type_WId_PK = dt.BusinessType_WID inner join aum.Dim_GroupCompany gc on dt.insurer_Wid = gc.GC_WID where bt.Business_Type_Wid in (4, 8, 10) and dt.ageing <> '<30' and cast(dt.[Brokerage Debtors] as numeric) > 0

How to create pivot using sql

主宰稳场 提交于 2020-11-29 19:32:42
问题 I am new to SQL, I have a table like this. Below is the query : select gc.GC_Name, dt.GC_SectorType, dt.ageing, sum(cast(dt.[Brokerage Debtors] as numeric)) as Brokerage_Amt, dt.divisionalofficename from [AR].[Fact_Brokerage_Debt] dt inner join AUM.DIM_BUSINESS_TYPE BT on BT.Business_Type_WId_PK = dt.BusinessType_WID inner join aum.Dim_GroupCompany gc on dt.insurer_Wid = gc.GC_WID where bt.Business_Type_Wid in (4, 8, 10) and dt.ageing <> '<30' and cast(dt.[Brokerage Debtors] as numeric) > 0

How to create pivot using sql

半腔热情 提交于 2020-11-29 19:32:31
问题 I am new to SQL, I have a table like this. Below is the query : select gc.GC_Name, dt.GC_SectorType, dt.ageing, sum(cast(dt.[Brokerage Debtors] as numeric)) as Brokerage_Amt, dt.divisionalofficename from [AR].[Fact_Brokerage_Debt] dt inner join AUM.DIM_BUSINESS_TYPE BT on BT.Business_Type_WId_PK = dt.BusinessType_WID inner join aum.Dim_GroupCompany gc on dt.insurer_Wid = gc.GC_WID where bt.Business_Type_Wid in (4, 8, 10) and dt.ageing <> '<30' and cast(dt.[Brokerage Debtors] as numeric) > 0

How to create pivot using sql

大憨熊 提交于 2020-11-29 19:31:12
问题 I am new to SQL, I have a table like this. Below is the query : select gc.GC_Name, dt.GC_SectorType, dt.ageing, sum(cast(dt.[Brokerage Debtors] as numeric)) as Brokerage_Amt, dt.divisionalofficename from [AR].[Fact_Brokerage_Debt] dt inner join AUM.DIM_BUSINESS_TYPE BT on BT.Business_Type_WId_PK = dt.BusinessType_WID inner join aum.Dim_GroupCompany gc on dt.insurer_Wid = gc.GC_WID where bt.Business_Type_Wid in (4, 8, 10) and dt.ageing <> '<30' and cast(dt.[Brokerage Debtors] as numeric) > 0