我有这个疑问暧昧的Mysql列
SELECT t.employee_id, t.timeinhour,t.timeouthour,
SEC_TO_TIME(SUM(TIME_TO_SEC(TIMEDIFF(t.timeouthour, t.timeinhour))))
AS Duration FROM timesheets t
INNER JOIN employeetimesheets et
ON t.employee_id=et.employee_id
WHERE employee_id='6748372'
AND timeinyear='2017'
AND timeinmonth='March'
AND isWeekNumber='1'
它给了我这个错误
1052 - 列在where子句是暧昧
我 'EMPLOYEE_ID'看了here和here但我没有使用all (*)
所以我不明白为什么?
只是做' t.employee_id ='6748372'' – bernie
你有't.employee_id'和'et.employee_id',对你来说它们是相同的并且保持相同的信息,但是MySQL不会跳到结论,你必须指定哪一个。只要引用'employee_id'就会变得模糊不清。 – Havenard