Monthly Payments By Species
###
Financial Charts
###
3000/MySQL rev01
###
The total payments per species, per month for a given year.
###
en
###
SELECT
s.SpeciesName,
MONTH(od.Date) AS bimonth,
SUM(od.Donation) AS total
FROM ownerdonation od
INNER JOIN animal a ON od.AnimalID = a.ID
INNER JOIN species s ON a.SpeciesID = s.ID
WHERE YEAR(od.Date) = $ASK STRING Which year to display for?$
GROUP BY s.SpeciesName, MONTH(od.Date)
###
GRAPH LINES
&&&
Monthly Payments By Species
###
Financial Charts
###
3000/PostgreSQL rev01
###
The total payments per species, per month for a given year.
###
en
###
SELECT
s.SpeciesName,
CAST(EXTRACT(MONTH FROM od.Date) AS INTEGER) AS bimonth,
SUM(od.Donation) AS total
FROM ownerdonation od
INNER JOIN animal a ON od.AnimalID = a.ID
INNER JOIN species s ON a.SpeciesID = s.ID
WHERE CAST(EXTRACT(YEAR FROM od.Date) AS INTEGER) = $ASK STRING Which year to display for?$
GROUP BY s.SpeciesName, EXTRACT(MONTH FROM od.Date)
###
GRAPH LINES
