I have the following statement in MYSQL:
SELECT Site, Areateam,
SUM( IF( year = '15-16', 1, 0 ) ) "Y2",
SUM( IF( year = '14-15', 1, 0 ) ) "Y1",
SUM('Y2') / SUM('Y1')* 100 AS Diff
FROM CD2015_EmailIncidents
WHERE Areateam = 'Greater Manchester'
GROUP BY Site
which returns the following results:
**Site |Areateam |Y2 |Y1 |Diff**
Acute Trust |Greater Manchester |0 |1 |NULL
Care Home |Greater Manchester |3 |22 |NULL
CD Store Room |Greater Manchester |7 |4 |NULL
College Greater |Greater Manchester |0 |1 |NULL
I cant seem to the correct syntax to show the percentage difference between Y2 and Y1 as it keeps displaying NULL
Many thanks Max