Hi everybody !
I have attached a very simple database that contain only 2 tables:
Houses
ID_House (PK , AutoNumber)
House (Text)
Bulbs
ID_Bulb (PK , AutoNumber)
ID_House (FK on Houses)
Bulb (text)
HasLight (Yes/No)
If (all bulbs in a house have light) OR (all bulbs in a house have not light) Then
all is OK, nothing to do.
And now, the question:
I am looking for SQL string that I can paste in a report Record Source in order to show me that houses where [some bulbs (at least one) have light] AND [some bulbs (at least one) have not light].
The report must show all the bulbs in those houses, grouped on houses.
The best is to see the attached database because I can't explain very well in English.
Note please that I can manage this (I have a solution based on an external function and more than one query) but I am looking for pure SQL (if it is possible) to manage things "at once" in a single query (SQL).
Thank you !
I have attached a very simple database that contain only 2 tables:
Houses
ID_House (PK , AutoNumber)
House (Text)
Bulbs
ID_Bulb (PK , AutoNumber)
ID_House (FK on Houses)
Bulb (text)
HasLight (Yes/No)
If (all bulbs in a house have light) OR (all bulbs in a house have not light) Then
all is OK, nothing to do.
And now, the question:
I am looking for SQL string that I can paste in a report Record Source in order to show me that houses where [some bulbs (at least one) have light] AND [some bulbs (at least one) have not light].
The report must show all the bulbs in those houses, grouped on houses.
The best is to see the attached database because I can't explain very well in English.
Note please that I can manage this (I have a solution based on an external function and more than one query) but I am looking for pure SQL (if it is possible) to manage things "at once" in a single query (SQL).
Thank you !