removePerson = connection.prepareStatement(
"DELETE FROM Patient where PatientId=? and FirstName=? and LastName=? and Address=? and PhoneNumber?" );
Joined: Dec 01, 2012
i have used this Query
"DELETE History, Patient " +
" FROM " +
" History INNER JOIN Patient ON History.PatientId = Patient.PatientId " +
" WHERE (Patient.PatientId)= ?" );
This Works only when the Two Tables are Filled with Info.. E.G Patient Number 18 is also on History Table This Code Removes the Patient from Both Tablets, But if Patient 19 is only on Patient Table it will Tell me Patient Not Removed.
I'm not sure all databases support deleting from views/joins. I would recommend to delete the data in two separate queries: first from the child table, then from the parent table. That is guaranteed to work in all databases out there.