mysql 报错Duplicate column name xxx

背景:使用Paginator插件进行分页时,如果查询的字段中有重复,就会报错 Duplicate column name xxx。

比如:select cust_name,cust_id,cust_name from user_info;字段cust_name重复;

如果单独执行查询语句,mysql是支持重复字段查询的,但是使用了Paginator插件后,会在查询SQL外面包一层进行统计;

就变成了select count(1) from (select cust_name,cust_id,cust_name from user_info) tmp ;

这样,mysql是不支持的,目前还没有特别清楚mysql对于这种sql的执行机制,先记录下来,日后有空再了解。

有知道的网友,忘多多留言,不吝指教!

猜你喜欢

转载自blog.csdn.net/ooobama/article/details/81943918