我有两张桌子:
employee 字段employee_id,名字,中间名,姓氏timecard 使用字段employee_id,time-in,time-out,tc_date_transaction我想选择具有相同employee_id的所有员工记录,其中timecard和date与当前日期相同.如果没有与当前日期相等的记录,那么即使没有time-in,timeout和tc_date_transaction,也会返回员工的记录.
我有这样的查询
SELECT *
FROM employee LEFT OUTER JOIN timecard
ON employee.employee_id = timecard.employee_id
WHERE tc_date_transaction = "17/06/2010";
Run Code Online (Sandbox Code Playgroud)
结果应该是这样的:
employee_id | firstname | middlename | lastname | time-in | time-out | tc_date_transaction
------------------------------------------------------------------------------------------
1 | john | t | cruz | 08:00 | 05:00 | 17/06/2010
2 | mary | j | von | null | null | null
mysql ×1