简体   繁体   English

SQL执行带有两个内部联接的查询

[英]SQL-Performing a query with two inner joins

I have the below query with two inner joins, however it is returning no data... UtranCell is the PK and CELL_ID is the FK which I'm performing the join on however the below is returning nothing for me. 我在下面的查询中有两个内部联接,但是它不返回任何数据... UtranCell是PK,而CELL_ID是我正在执行联接的FK,但是下面的查询对我没有任何回报。

Would appreciate any help! 将不胜感激!

select 
c3.MeContext AS RNC,
c3.UtranCell,
c3.cId,
a3.azimut, 
d3.h_width, 
d3.v_width 
FROM E3G.UtranCell c3 
INNER JOIN 
(
select 
ct3.CELL_ID,
t3.TX_ID,
t3.azimut,
s3.NAME AS 'SITE_ID', 
s3.SITE_NAME, 
from ATL.UCell ct3, ATL.UTransmitter t3, ATL.Site s3 
WHERE ct3.TX_ID=t3.TX_ID AND t3.SITE_NAME=s3.NAME) a3 
on c3.UtranCell=a3.CELL_ID
INNER JOIN 
(
select 
ct3.CELL_ID,
t3.TX_ID,
t3.antenna_name,
ant1.physical_antenna,
ant1.h_width,
ant1.v_width 
from ATL.UCell ct3,ATL.UTransmitter t3, ATL.Antenna ant1 
WHERE ct3.TX_ID=t3.TX_ID AND ant1.physical_antenna=t3.antenna_name) d3 
on c3.UtranCell=d3.CELL_ID

try to use the left join. 尝试使用左联接。 and with this, you can understand which data the query doesn't retrive. 这样,您就可以了解查询不检索哪些数据。


or you can try to execute, the first query with 1 join, and try to understand which join not work how do you want. 或者您可以尝试执行带有1个联接的第一个查询,并尝试了解哪个联接不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM