我正在尝试创建一个查询,搜索所有共享类似属性的记录,如下所示:
select * from table_A
where fullname like in (select firstname from employees where X)
唯一的问题是这只是我的伪代码,我实际上正在排序很多表,所以我目前的真实查询看起来像:
select * from devices
where devicename like in (select X from X1 where T in (select T from T1 where Y in (select Y from Y1 where Z in (select Z from Z1 where AreaName = '74';
我正在尝试使用join命令,但对如何将其应用于此情况非常困惑.
最佳答案 尝试:
SELECT d.*
FROM devices d
INNER JOIN X1 ON d.devicename like '%'||x1.X||'%'
INNER JOIN T1 ON x1.T = T1.T
INNER JOIN Y1 ON T1.Y = Y1.Y
INNER JOIN Z1 ON Y1.Z = Z1.Z
WHERE Z1.AreaName = '74'