Using NHibernate 1.0.2
I have a query where I would like select contacts, with their cell phone numbers if they have one. My Contact entity has a Phones collection, and each Phone entity in that collection has a PhoneType property.
So, I tried this:
SELECT Contact.Name, CellPhone.Number
FROM Contact
LEFT JOIN Contact.Phones AS CellPhone
WHERE (CellPhone.PhoneType = 'Cell' OR CellPhone.PhoneType IS NULL)
However, it only returns contacts that either have a cell phone, or have no phone at all. It doesn't return contacts that have one or more non-cell phones but no cell phone. I want to get a row back whether or not the contact has a cell phone.
How do I do this? In SQL, the "PhoneType = 'Cell'" criteria would go in the ON clause of the join, but that's not possible in HQL ...
|