Euthanasia Reasons by Species and Date
###
Statistics
###
Any rev02
###
Euthanasia reasons for animals, grouped by species and between two dates.
###
en
###
SELECT ReasonName, SpeciesName, COUNT(PTSReasonID) AS Total FROM animal 
INNER JOIN deathreason ON deathreason.ID = PTSReasonID
INNER JOIN species ON animal.SpeciesID = species.ID
WHERE DeceasedDate >= '$ASK DATE Enter date from$' AND DeceasedDate <= '$ASK DATE Enter date to$'
AND PutToSleep = 1 AND NonShelterAnimal = 0 AND DiedOffShelter = 0 AND IsDOA = 0
GROUP BY SpeciesName, ReasonName
ORDER BY SpeciesName, ReasonName
###
$$HEADER
HEADER$$

$$GROUP_SpeciesName
$$HEAD
<h2>$SpeciesName</h2>

<table border=1>
<thead>
<tr>
<th><b>Reason</b></th>
<th><b></b></th>
</tr>
</thead>
<tbody>
$$FOOT
</tbody>
</table>

<p><b>Total for $SpeciesName: {SUM.Total.0}</b></p>
GROUP$$

$$BODY<tr>
<td>$ReasonName</td>
<td>$Total</td>
</tr>
BODY$$

$$FOOTER
FOOTER$$


