cuedog wrote:
1. Breakdown by numbers of patients classified by type of diets.
2. Display a list of all patients that were treated for the same diagnosid during the past 30 days.
|
Well if you don't need the breakdown by date (ie the numbers from the last 30 days), it's not that hard. I'll show you how to do it without the date, and if you need the date, it should not be to hard to add...
SELECT count(patient_id), diet
FROM patient_status
GROUP BY diet;
Basically just get the count of patient_id's, and group by their diets. That will give you all of the patients for that diet, but there is no date restriction, it will go all the way back to the beginning of your data.