Hi all !
I know. The thread title sound strange but...
This is the very simplified scenario:
I have 4 tables:
- House (ID_House, Address)
- Rooms (ID_Room, TypeOfRoom) 'Bathroom, Living room ...
- Bulbs (ID_Bulb, Power)
- Lights(ID_Light , ID_House, ID_Room, ID_Bulb)
A house can have any number of different rooms (even zero)
In a room can be any numbers of bulbs (even zero).
The room table is not "close": in time I can add (or delete) more type of rooms (but I can't delete a room IF it has a bulb).
I need a report like a table:
Row headers: ID_House
Column headers: ID_Room
Intersection: ID_Bulb (if a bulb exist; blank if it is not a bulb in that room)
If in a room there are two or more bulbs I need two or more rows with the same ID_House and ID_Room
How you solve that ?
It is possible to define such query ?
What about if the Room table is "fixed" ? I think must be easier to design the report but still I don't know "how to".
Thank you !
I know. The thread title sound strange but...
This is the very simplified scenario:
I have 4 tables:
- House (ID_House, Address)
- Rooms (ID_Room, TypeOfRoom) 'Bathroom, Living room ...
- Bulbs (ID_Bulb, Power)
- Lights(ID_Light , ID_House, ID_Room, ID_Bulb)
A house can have any number of different rooms (even zero)
In a room can be any numbers of bulbs (even zero).
The room table is not "close": in time I can add (or delete) more type of rooms (but I can't delete a room IF it has a bulb).
I need a report like a table:
Row headers: ID_House
Column headers: ID_Room
Intersection: ID_Bulb (if a bulb exist; blank if it is not a bulb in that room)
If in a room there are two or more bulbs I need two or more rows with the same ID_House and ID_Room
How you solve that ?
It is possible to define such query ?
What about if the Room table is "fixed" ? I think must be easier to design the report but still I don't know "how to".
Thank you !
Comment