有一次,根据客户需求,要求将同一天的产品中分组后,并分别把这一天的产品全部列表出来,且要按时间最新排序
于是编写了语句如下:
$query="SELECT * FROM (SELECT * FROM pos_resend_order ORDER BY id DESC ) GROUP BY date ORDER BY id DESC ";
但执行时,mysql提示错误:mysql #1248。。。。。
解决方法是,缺少别名,于是添加上,运行正常:
$query="SELECT * FROM (SELECT * FROM pos_resend_order ORDER BY id DESC )asa GROUP BY date ORDER BY id DESC ";
转载于:https://blog.51cto.com/easonslove/1583384