Question
SELECT SUM(mytable.WA) AS weightedAverage, mytable.state AS state, mytable.year AS year FROM (SELECT StateData.StateShort AS state, StateData.DataYear AS year, ((StateData.ExpEmpValue/TotalStateEmp.TotalEmp)*Gamma.Gamma) AS WA FROM StateData JOIN (SELECT
SELECT SUM(mytable.WA) AS weightedAverage, mytable.state AS state, mytable.year AS year FROM (SELECT StateData.StateShort AS state, StateData.DataYear AS year, ((StateData.ExpEmpValue/TotalStateEmp.TotalEmp)*Gamma.Gamma) AS WA FROM StateData JOIN (SELECT SUM(StateData.ExpEmpValue) AS TotalEmp, StateData.StateShort AS state FROM StateData WHERE StateData.DataYear=2012 AND StateData.IndustryCodeLength=6 GROUP BY StateData.StateShort) AS TotalStateEmp ON StateData.StateShort=TotalStateEmp.state JOIN Gamma ON Gamma.IndustryCode=StateData.IndustryCode AND Gamma.DataYear=StateData.DataYear WHERE StateData.DataYear=2012 AND StateData.IndustryCodeLength=6) AS mytable GROUP BY mytable.state, mytable.year
Above is the average level of agglomeration by state in 2012.
How would I change the code to find the average level of Competitiveness (HHI)?
This is in SQL.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started