关于Mybatis报错Translating SQLException with SQL state '42000', error code '1064', mess

今天调试毕设项目的时候,改了mapper的一些sql语句后,一直报这个错:

Mybatis报错Translating SQLException with SQL state '42000', error code '1064', message [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN ah_activity aha ON aha.id = ahua.activity_id
  		LEFT JOIN ah_activity' at line 7]; SQL was [] for task [
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN ah_activity aha ON aha.id = ahua.activity_id
  		LEFT JOIN ah_activity' at line 7
### The error may exist in crj/ah/ssm/mapper/custom/AhUserActivityMapperCustom.xml
### The error may involve crj.ah.ssm.mapper.custom.AhUserActivityMapperCustom.getCount-Inline
### The error occurred while setting parameters
### SQL: select          count(1)         FROM      ah_user_activity ahua            WHERE  ahua.user_id = 7      LEFT JOIN ah_activity aha ON aha.id = ahua.activity_id     LEFT JOIN ah_activity_space ahas ON ahas.id = ahua.space_id      LEFT JOIN ah_activity_area ahaa ON ahaa.id = ahua.area_id      LEFT JOIN ah_activity_seat ahase ON ahase.id = ahua.seat_id      LEFT JOIN ah_user ahu ON ahu.id = ahua.user_id      LEFT JOIN ah_manager ahm1 ON ahm1.id = ahua.createuser   LEFT JOIN ah_manager ahm2 ON ahm2.id = ahua.updateuser      order by ahua.updatetime desc
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LEFT JOIN ah_activity aha ON aha.id = ahua.activity_id
  		LEFT JOIN ah_activity' at line 7
]

检查了好多次,还是觉得语法没有错啊!!!!后来才发现,where 应该放在left join 语句的后面!!!!!

附上sql各语句的执行顺序

(8)SELECT (9)DISTINCT  (11)