MyCATApache / Mycat-Server

GNU General Public License v2.0
9.5k stars 3.85k forks source link

SELECT DISTINCT h.* 报错 #1344

Open joew2016 opened 7 years ago

joew2016 commented 7 years ago

mysql> SELECT DISTINCT h. FROM hosts h,host_discovery hd,items i,hosts ph WHERE h.flags='2' AND h.hostid=hd.hostid AND hd.parent_itemid=i.itemid AND i.hostid=ph.hostid AND ph.flags=0 AND 1=0; ERROR 1064 (42000): 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 '' at line 8

SELECT DISTINCT h. 这种语句会报错 SELECT h. 这种就不会报错

这个BUG可以修复不

robatter commented 6 years ago

查询里面有相同字段名时会有这种情况,可以 select from (SELECT DISTINCT h. ...)