There’s a badge query for exactly that in this post
You’d add it under Admin > Badges > New > Badge Query (SQL)
Admin > Badges > New > Badge Query (SQL)