I gave up on trying to follow all the nested brackets - I think you would help both yourself and us if you formatted such a query! I think the error means that you are joining on columns of differing types. (E.g.: SELECT * FROM a JOIN b ON a.id = b.id, where a....
copy it, and paste it into theHTML Edit Viewof your post. If you don’t see a bunch of stuff in brackets and slashes then you’re not in HTML view. It is accessible at the top right of your post editing (writing) view in