You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order by hdt.cislodresu' at line 1 select hvu.*,hdt.jmeno,hdt.prijmeni,hdt.cislodresu from hracvutkani hvu,hracdruzstva hdt where hvu.idhrac = hdt.id and hvu.idsoutez = 273 AND hvu.cisloutkani = 'MLZ012' AND hdt.idtym = order by hdt.cislodresuYou have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order by hdt.cislodresu' at line 1 select hvu.*,hdt.jmeno,hdt.prijmeni,hdt.cislodresu from hracvutkani hvu,hracdruzstva hdt where hvu.idhrac = hdt.id and hvu.idsoutez = 273 AND hvu.cisloutkani = 'MLZ012' AND hdt.idtym = order by hdt.cislodresu