I have a tabled defined as:
create table #YearlyTreatmentData(
TreatmentCount int );
The table holds the yearly treatment details for a patients with the type of treatment as TreatedWith, and the number of times treated that year with the treatment as TreatmentCount.
EyeId is a patient id.
I need a Query that will delete all the rows where a patient(EyeId) has been treated by anything other than the specific treatment i am interested in.
If i am looking for patients treated with PDT then i want to keep the patients that have ONLY been treated with PDT. The rest must be deleted.
Patients treated with something else, or patients that have been treated with PDT and something else must be deleted from the table.
I guess (using logic from my previous question) i must delete patients where the sum of all their treatments does not equal the sum of their treatments with PDT i.e. the patients that have changed treatment.
And then also delete every row that is not PDT i.e. the patients treated with something else-
Just dont know how to express this as a delete statement.