jmichael18
asked on
help with SQL conditional report
i have a table (stacked) with variables cipcode, awlevel, unitid, and year.
im trying to generate a report that will tell me the distinct count of unitid where awlevel=5 and cipcode=45.0601 in 2001 but not 2011. Basically i need results where cipcode only exists when year=2001 and doesnt exist when year=2011.
so far i have this, which gives me the results for 2001 only
I think the answer involves nested selects but i cant wrap my head around it.
im trying to generate a report that will tell me the distinct count of unitid where awlevel=5 and cipcode=45.0601 in 2001 but not 2011. Basically i need results where cipcode only exists when year=2001 and doesnt exist when year=2011.
so far i have this, which gives me the results for 2001 only
select count(distinct(unitid)) as Grad11 label="Schools with Graduations",
from stacked
where awlevel=5 and cipcode='45.0601' and year=2001;
I think the answer involves nested selects but i cant wrap my head around it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER