I have a table with the following structure – steamid, itemid, eventid, value , all just ints or big ints that log hourly data I insert. So a user most likely has multiple entries with the same steamids, itemids, and even values.
I’m trying to get the 100 top values – but the same item must not repeat.
What I have so far is
SELECT itemid,value,steamid
FROM $table
GROUP BY itemid
ORDER BY value DESC
LIMIT 0,100
Which gives me this data set (sample only here):
itemid value steamid
=================================================
599291414 66397 76561198032389066
779150329 62882 76561198001229760
773965297 51895 76561198014617403
332883551 43201 76561197992659494
333434836 40880 7656119799359013
However, this for some reason ignores the true largest value listed in the table. I’m not sure how else I can format this so that I can ignore duplicate entries with the same itemid and steamid. I don’t think I can group by steamid because then it would ignore other items that could be associated with a steamid.
Here’s the first few if I select without grouping.
itemid value steamid
=====================================
1011809265 753665 76561198010314894
376615188 101684 76561197989760193
478937438 83448 76561198010314894
478937438 83448 76561198010314894
376662587 72693 76561197989760193
376662587 72693 76561197989760193
599291414 66454 76561198032389066
599291414 66454 76561198032389066
599291414 66454 76561198032389066
Insight appreciated and I’ll gladly answer any questions that may help in figuring this out.
Try
This should unique itemid, but then give you only the single values.