婆罗门
精华
|
战斗力 鹅
|
回帖 0
注册时间 2007-1-21
|
引用第8楼wowhy于2013-06-18 16:30发表的 :
mysql 这样的语法没有错误?? billno 不在 group by 子句里啊
 MySQL extends the use of GROUP BY so that you can use non-aggregated columns or calculations in the SELECT list that do not appear in the GROUP BY clause. You can use this feature to get better performance by avoiding unnecessary column sorting and grouping. For example, you do not need to group on customer.name in the following query:
SELECT order.custid, customer.name, MAX(payments)
FROM order,customer
WHERE order.custid = customer.custid
GROUP BY order.custid;
In standard SQL, you would have to add customer.name to the GROUP BY clause. In MySQL, the name is redundant |
|