Adding filter syntax to mysql joins