如何在不使用连接的情况下在多个表之间移动
How to move between several tables without using joins
我需要"Display all the columns of Employee for those employees who invoiced a vehicle that was owned by a dealership that is different than the dealership that the employee works for."
我不允许使用联接来回答这个问题,所以我对如何从这些 table 中获取所有信息感到有点困惑。我需要查看员工是否为车辆开具发票,然后确定该车辆在哪个经销商处出售,然后确定该经销商 ID 代码是否与员工 ID 代码相同。
使用 join 有哪些可能的替代方法。
发票、员工、经销权和车辆都是各自的 table。
嵌套语句是一种可能的选择。
select * from Employees e
where employeeID is in
(select ieid from Invoice
where ivin is in
(select vehicleID from Vehicle
where vdcode <> e.edcode))
我需要"Display all the columns of Employee for those employees who invoiced a vehicle that was owned by a dealership that is different than the dealership that the employee works for."
我不允许使用联接来回答这个问题,所以我对如何从这些 table 中获取所有信息感到有点困惑。我需要查看员工是否为车辆开具发票,然后确定该车辆在哪个经销商处出售,然后确定该经销商 ID 代码是否与员工 ID 代码相同。
使用 join 有哪些可能的替代方法。
发票、员工、经销权和车辆都是各自的 table。
嵌套语句是一种可能的选择。
select * from Employees e
where employeeID is in
(select ieid from Invoice
where ivin is in
(select vehicleID from Vehicle
where vdcode <> e.edcode))