I have three tables in my Crystal Reports and it looks like this:
Property
ID
Other Data
Unit
ID
PropertyID <-- fk to Property
Other Data
Tenant
ID
UnitID <-- fk to Unit
Other Data
The report is going to show only Unit's (grouped by the property they belong to) that do not have any tenant's linked to it. Some nice people have helped me figure out the SQL for the query and it's like this:
SELECT Unit.ID
FROM Unit
WHERE NOT EXISTS (SELECT 1 FROM Tenant WHERE Unit.ID = UnitID)
Now, I know I have to group by Property --> Units
but that's about as far as I know. It turns out the SQL Expression Fields only allow for the return of a single result and not a result set so searching though the result set from the above query can't be done that way, and I can't just enter plain sql.
How can this be done?