I wasn't sure how to search for a solution this scenario. So I'm posting it here hoping for some help. I wouldn't be surprised if it's a simple solution that I'm overlooking. :)
[code language="sql"]
[code language="sql"]