I want to get one random library card from each group, group are column "state"
select library card, state
from [stategov]..library
where states in (
'Ohio',
'Arizon'
)
group by state, librarycard
Should I use top 1? or CTE?
Since each state can have more than 10,000 library cards. What is the best way to get one random library cards from each state using group by?