still no ddl and inserts...
but in this case it should be simply
Select state_ind,
sum(State_Count ),
max(Total ),
max(case when Month_ = 'July' then State_Count else null end) as July,
max(case when Month_ = 'August' then State_Count else null end) as August
From ...
group by state_ind
check the standard SQL aggregation documentation...
↧