I'll try and elaborate my question in the simplest form possible. I'm creating an e-commerce website and I'm trying to set up filters for the search result. Everything has been just fine, until I ran into this following issue. When I try to group by id I lose all the other foreign keys to the specification value and if I remove the group by I get a ton of results, each containing own foreign key to the value. (I'm inner joining each article with respective specification values). My question therefore is how do I filter all of these specification ids?
My query (translated and simplified) is as follows:
select * from article
left join article_specification on article_specification.fk_articles=article.id
where (fk_specification_value=172 or fk_specification_value=175 or fk_specification_value=184)
group by id order by date desc
By running this query I get 1 result (hence the group by), however if I don't group I can't really do anything with that result set. If I change the ORS into ANDS in the query, I get nothing, since there is only 1 value. That's the root of my question. Thanks in advance, sorry if my question was a little bit poorly sentenced.