Problem: A model has 'n' drawbacks and 'm' capabilities. There are three tables(models, capabilities and drawbacks).
Table description:
models (model_id(pk), model_name)
capabilities ([model_id, cap_id](pk),capability)
drawbacks ([model_id, draw_id](pk),drawback)
Relationship:
model-id of tableModels is related to model_id of tableCapabilities and tableDrawbacks.
Query: i am querying for a model's capabilities and drawbacks as follows:
SELECT models.model, capabilities.capability, drawbacks.drawback
FROM (models INNER JOIN capabilities ON models.model_id = capabilities.model_id) INNER JOIN drawbacks ON models.model_id = drawbacks.model_id
The query yilds correct result, though. That, is not my problem.
My problem is: How do I avoid repetition? Eg. Model "A" has a,b and c (i.e., 3) capabilities while having p,q,r,s and t (i.e., 5) drawbacks.
The above query yields for every capability all the fie drawbacks. Not to mention that the model name will also repeat. Thus I will end up with (3x5=)15 rows of information.
The information as displayed poses a challenge to the reader in order for him/her to arrive at a meaningful conclusion.
How do I avoid that repetion?
Table description:
models (model_id(pk), model_name)
capabilities ([model_id, cap_id](pk),capability)
drawbacks ([model_id, draw_id](pk),drawback)
Relationship:
model-id of tableModels is related to model_id of tableCapabilities and tableDrawbacks.
Query: i am querying for a model's capabilities and drawbacks as follows:
SELECT models.model, capabilities.capability, drawbacks.drawback
FROM (models INNER JOIN capabilities ON models.model_id = capabilities.model_id) INNER JOIN drawbacks ON models.model_id = drawbacks.model_id
The query yilds correct result, though. That, is not my problem.
My problem is: How do I avoid repetition? Eg. Model "A" has a,b and c (i.e., 3) capabilities while having p,q,r,s and t (i.e., 5) drawbacks.
The above query yields for every capability all the fie drawbacks. Not to mention that the model name will also repeat. Thus I will end up with (3x5=)15 rows of information.
The information as displayed poses a challenge to the reader in order for him/her to arrive at a meaningful conclusion.
How do I avoid that repetion?