如何更改此代码

时间:2010-08-23 09:27:23

标签: mysql

SELECT DATE(A.Inspection_datetime) AS Date,  
  A.Model,  
  COUNT(A.Serial_number) AS Qty,  
  B.Name  
FROM inspection_report AS A  
LEFT JOIN Employee AS B ON A.NIK = B.NIK  
 GROUP BY A.Model, A.Serial_number 

1 个答案:

答案 0 :(得分:5)

猜测(相信我,我猜)

SELECT DATE(A.Inspection_datetime) AS Date,   
  A.Model,   
  COUNT(A.Serial_number) AS Qty,   
  B.Name   
FROM inspection_report AS A   
LEFT JOIN Employee AS B ON A.NIK = B.NIK   
 GROUP BY A.Model, B.Name   

您需要按照您未聚合的字段进行分组