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
views:
50answers:
1
+3
A:
At a guess (and believe me, I'm guessing)
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
You need to group by the fields you're not aggregating
Binary Worrier
2010-08-23 09:31:55
For bonus points, change the alias for Employee from `B` to `Beat`, then you can have a `Beat.Nik` :)
Binary Worrier
2010-08-23 09:35:57
For mega bonus points, then change nik to root, then you will have a beat.root which is a tasty and healthy vegetable whose promotion can only better the world.
Tom Gullen
2010-08-23 09:37:38