Lifeseeker
Registered User.
- Local time
- Today, 00:56
- Joined
- Mar 18, 2011
- Messages
- 273
Hello,
I have a database that's based on a one-to-many relationship.
Two tables, facility and storage space.
Both facility and the storage space have chairs, and we are interested in the number of chairs in both the facility and the storage space.
A facility can have multiple storage space, but a storage space can belong to only one facility.
The other thing is that the facility can be located in a different city than the storage space. So you can have a facility that is located in city A, and all its storage space is in different cities.
How would I be able to produce a query that simply tell users how many chairs there are in a given geographic location without counting the facility multiple times?
I have attached a small screenshot of what the data looks like:
So in the screenshot, you are see repeating Fs. This is because they all have a S attached to it.
Take F0103 as an example in the screenshot. Although there is 0 chair, I do not want to count 0 five times, for F0103 is repeating 5 times. If F0103 is expanding to include more chairs, then I don't want the query to count those chairs just because the facility is repeating. The facility is the same, but it's repeating because of storage space attached.
The total sum query is not an issue for storage facilities as you can see in the screenshot.
Is there a way around this? So to keep the facility list unique while still having a breakdown of the storage?
Any thoughts/comments much appreciated.
I have a database that's based on a one-to-many relationship.
Two tables, facility and storage space.
Both facility and the storage space have chairs, and we are interested in the number of chairs in both the facility and the storage space.
A facility can have multiple storage space, but a storage space can belong to only one facility.
The other thing is that the facility can be located in a different city than the storage space. So you can have a facility that is located in city A, and all its storage space is in different cities.
How would I be able to produce a query that simply tell users how many chairs there are in a given geographic location without counting the facility multiple times?
I have attached a small screenshot of what the data looks like:
So in the screenshot, you are see repeating Fs. This is because they all have a S attached to it.
Take F0103 as an example in the screenshot. Although there is 0 chair, I do not want to count 0 five times, for F0103 is repeating 5 times. If F0103 is expanding to include more chairs, then I don't want the query to count those chairs just because the facility is repeating. The facility is the same, but it's repeating because of storage space attached.
The total sum query is not an issue for storage facilities as you can see in the screenshot.
Is there a way around this? So to keep the facility list unique while still having a breakdown of the storage?
Any thoughts/comments much appreciated.