I believe this is a somewhat specific question, because I do not find anything related yet.
I have a table named contas_produtos
, which is a NxN relation between the contas
and the produtos
tables.
The table has the following columns:
ID (PK)
conta_id (FK)
produto_id (FK)
precoFinal (float)
Well, this precoFinal
indicates the final value of a given product, which can be changed by the application, that is, two products can have the same id
, but with values other than precoFinal
. p>
What I want to do is to be able to group the products of the same id
, but with equal final prices, and to separate those products from those that have id
but different final prices.
I know that I can not simply group by precoFinal
because I would pick products with different prices.
What I've done so far has been grouping by id
, but it does not suit me, so it does not even pay for me to put my SQL here.
Much text, I know, but I think it would be easier to explain like this. Thanks