To make this example simple, lets pretend my table has the following attributes.
Table
ID: Int
Amount: Int
nameId: Int
Records Ex
ID: 1
Amount: 2
nameId: 3
ID: 2
Amount: 2
nameId: 3
ID: 3
Amount: 1
nameId: 3
Currently I have the following query.
SELECT DISTINCT(amount) FROM server.`inventory` where nameid = 558
It gives me
Amount 1
Amount 2
Straight forward, it selects a unique records base on amount. However, how can I also include in my query so that it counts how many id's are using that amount with nameid 558
So the output should be
Amount 1, Used 1
Amount 2, Used 2