字段列表错误中的未知列

时间:2016-02-19 16:33:06

标签: mysql join

我正在对一堆表进行内部联接,我肯定会让所有这些表都存在。但是每当我输入我的查询时,它总是说'

  

未知栏' tbl_undertime.ut_date'在'字段列表'

我非常确定tbl_undertime是我数据库下的一个表,但我不知道为什么它会一直返回这样的错误。我已经放弃了桌子并再次使用相同的名称和列创建了一个新表,但仍然给出了同样的错误。

非常感谢帮助。

select tbl_employee.lname, tbl_employee.fname, tbl_employee.mi,     
tbl_employee.sss_no,
tbl_employee.philhealth_no, tbl_employee.dept_id, tbl_employee.salaryperday,
tbl_earlyout.timeout_date, tbl_late.late_date, tbl_overtime.ot_date,    
tbl_absent.absentdate,
tbl_leave.leave_type, tbl_leave.start_date, tbl_leave.end_date,   
tbl_undertime.utdate, tbl_cashadv.cashadv_date,
tbl_pay15.gross_sal
from tbl_employee
inner join tbl_earlyout
on tbl_employee.empid = tbl_earlyout.empid
inner join tbl_late
on tbl_late.empid = tbl_overtime.empid
inner join tbl_overtime
on tbl_overtime.empid = tbl_absent.empid
inner join tbl_absent
on tbl_absent.empid = tbl_leave.empid
inner join tbl_leave
on tbl_leave.empid = tbl_undertime.empid
inner join tbl_cashadv
on tbl_cashadv.empid = tbl_pay15.empid;

+---------------+---------+------+-----+---------+-------+
| Field         | Type    | Null | Key | Default | Extra |
+---------------+---------+------+-----+---------+-------+
| ut_id         | int(11) | NO   | PRI | NULL    |       |
| empid         | int(11) | YES  | MUL | NULL    |       |
| utdate        | date    | YES  |     | NULL    |       |
| ut_mins_hours | double  | YES  |     | NULL    |       |
+---------------+---------+------+-----+---------+-------+

1 个答案:

答案 0 :(得分:1)

查看您的代码,您的表格列显示为utdate而不是ut_date。我想象一个错字是你的问题,因此Unknown column 'tbl_undertime.ut_date