Fix for: Banners matched only by tags results in SQL error

The category table is falsely included/not included. Long story short, this fixes #5000 and is a better fix than #5098 See there for testing instructions.