Reputation: 21
I have a query:
select min(price),
max(price),
name
from Table1
group by name
As a result I get table with:
name | minimal(price) | maximum(price)
but I also get rows where price is the same. How to fix it? (I don't need rows with same value)
Upvotes: 2
Views: 507
Reputation: 153
if I got it right one name field has 2 same fields of price in result query.
select min(price),
max(price),
name
from Table1
group by name, price
Upvotes: 0
Reputation: 62831
Use having
:
select min(price), max(price), name
from Table1
group by name
having max(price) != min(price)
Upvotes: 8