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 'AND pet.pet_id = powners.powner_pet_id ORDER BY pet.pet_dturn ASC' at line 1