I've been working on this query and it's working as intended by displaying one output per p.ID since I'm grouping by p.ID (since there would be multiple p.ID values without the grouping.) However, depending on the p.ID, I will sometimes get a value of e.alternateEventDurationInMilliseconds that is not the fastest e.alternateEventDurationInMilliseconds.
Is there a way I could still use the GROUP BY p.ID but also add a check to get the minimum e.alternateEventDurationInMilliseconds as long as the duration is still > 0? Otherwise, I'll be given a random value by default that is greater than 0, but I want to specifically get the minimum duration that is greater than 0, with only one row per p.ID.
Thanks! :)
SELECT
p.ID,
e.personaId,
e.EVENTID,
e.alternateEventDurationInMilliseconds
FROM
EVENT_DATA e
INNER JOIN
PERSONA p ON e.personaId = p.ID
WHERE
e.EVENTID = '43' AND e.alternateEventDurationInMilliseconds > '0'
GROUP BY
p.ID
ORDER BY
e.`alternateEventDurationInMilliseconds` ASC