orddr by和group by在语句上的复杂查询

6fe3ivhb  于 2021-06-20  发布在  Mysql
关注(0)|答案(0)|浏览(168)

我在语句上尝试了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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题