Interesting query.
So you want to have the first two records where SMR is the same value...
so if your list was
a,b,c,e,a, you'd get A
and
b,c,d,c,a would get C?
This won't do:
SELECT * FROM current
WHERE group_name = \"$group_name\"
AND smr in ("A", "B", "C", "D")
ORDER BY smr
limit 2
because you'd get the first two records where SMR is A,B,C or D, not where both are A or both as B etc...
I fear you may have to do four queries to get the 'relative position' of the topmost SMR=A records and the topmost SMR=B etc, and compare those to decide which of ABCD is the highest, and fetch those.
Either that or hefty subqueries/internal variables