While writing the backend for this blog, I needed to be able to select the most relevant topics to display at the bottom of each post based on shared tags. It is a little more complex than standard select queries so I figured I would post it up here in case someone happens to be searching for this particular solution.