我是MySQL的新手,我尝试创建以下查询:
SELECT locations.PuP, processing_system.deposited_timedate
FROM locations
INNER JOIN employee ON employee.fk_location = location_id
INNER JOIN processing_system ON processing_system.fk_emp = employee.emp_id
WHERE processing_system.deposited_timedate BETWEEN '2020-07-08 00:00:00' AND '2020-07-08 23:59:59'
These are the tables I want to use
These are the data in the tables
该查询似乎有效,除非它仅给我表名称而不包含任何数据。有人可以帮忙解决吗?
答案 0 :(得分:0)
基本上,您没有收到结果,因为employee表中的fk_location为空。因此,这是您表中的数据问题。 你可以试试这个吗我已删除两者之间的内容,并使用了比较。
SELECT loc.Pup, psys.deposited_timedate
FROM
Locations AS loc
INNER JOIN
Employee AS emp ON emp.fk_location = loc.location_id
INNER JOIN
Processing_system AS psys ON psys.fk_emp = emp.emp_id
WHERE
psys.deposited_timedate > '2020-07-08 00:00:00'
AND psys.deposited_timedate < '2020-07-08 23:59:59'