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 'and e1.DI = dimos.DI order by e1.DI,e1.NO' at line 1