I have two tables : patients and patients_guest.
I would like to have the patients who have a lastname starting by X (parameter) in both tables. I think that's a simple UNION with: WHERE P.lastname LIKE "' . $x . '%"
The problem is that a patient may be in both tables. I need to check that there is only one lastname-firstname-birthDate returned (note that there may be two patients with same lastname and firstname, that's why they have to have the same birthday to be considered as duplicated).
The fields to return are :
is_guest (this must be generated, should be true if the record is from patients_guest, false otherwise).
Thank you for any help