On first glance I can see two things (possibly) wrong with the query. I don't believe you can LEFT JOIN to another table more than once. Secondly on the 'WHERE thead.threadid IN (' you have a big gap between the values halfway through. I don't know if mysql strips whitespace or not.
I don't know what to suggest as my MySQL knowledge is a little shaky. I think it may need a different kind of JOIN or possibly combining the two LEFT JOIN's into one using AND/OR when you JOIN the table ON.
|