我在声明中尝试了ORDER BY和GROUP BY,但ORDER by无法正常工作;这是代码:SELECT ter_code, ter_name, tgp_longitude, tgp_latitude FROM tblterminalgps, tblterminal WHERE ter_status != ? AND tgp_teruid = ter_uid GROUP BY ter_uid ORDER BY tgp_datecreated DESC
第二次尝试时,我尝试了以下方法:SELECT t2.ter_code, t2.ter_name, t1.tgp_longitude, t1.tgp_latitude FROM tblterminalgps as t1 INNER JOIN tblterminal as t2 ON t1.tgp_teruid = t2.ter_uid
(SELECT * FROM tblterminalgps GROUP BY t1.tgp_teruid DESC)
ORDER BY tgp_datecreated DESC
我得到了这样的错误: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 'SELECT * FROM tblterminalgps GROUP BY t1.tgp_teruid DESC)
ORDER BY tgp_datecrea' at line 2