记录甚至不显示使用PL SQL在查询中存在记录

时间:2017-07-07 09:16:00

标签: oracle plsql

我编写了一个查询来使用唯一SAPIDCandidateID来获取记录,但记录没有被提取。

但是存在相同的SAPID和candidateId记录。这是我在下面的查询

SELECT VT.*,VTS.STATUS_NAME
        FROM TBL_VSAT_MST_DETAIL VT 
        LEFT JOIN TBL_VSAT_STATUS_MST VTS ON VT.STATUS_ID = VTS.STATUS_ID
        WHERE VT.SAP_ID = 'I-KA-CTPR-ENB-9016'
        AND VT.CANDIDATE_ID = 'C3';

请建议我错在哪里

更新

SELECT ENB.SAP_ID AS SAP_ID,CAND.CANDIDATEID AS CANDIDATE_ID,ENB.R4G_STATE AS STATE,ENB.SITE_TYPE AS SITETYPE,CAND.SITENAME AS SITENAME,
CAND.STATUS AS CANDIDATESTATUS ,ENB.SITEID AS SITEID,ENB.PRIORITY_SITE AS PRIORITYSITE,ENB.CIRCLE AS CIRCLE,
DECODE (VTS.STATUS_NAME,null, 'Fill Vendor Survey form', VTS.STATUS_NAME) AS VSATSTATUS,
ENB.LATITUDE, ENB.LONGITUDE, VTS.STATUS_ID
FROM R4G_OSP.ENODEB ENB
INNER JOIN R4G_OSP.CANDIDATE CAND ON ENB.SAP_ID = CAND.SAP_ID
LEFT JOIN TBL_VSAT_MST_DETAIL VT ON ENB.SAP_ID = VT.SAP_ID
LEFT JOIN TBL_VSAT_STATUS_MST VTS ON VT.STATUS_ID = VTS.STATUS_ID
WHERE ENB.SCOPE = 'EnodeB-Connected_MW'
AND ENB.SITEBACKHAUL = 'MW'
AND CAND.STATUS = 'Fill Vendor Survey Form'
AND (VT.STATUS_ID IS NULL OR VT.STATUS_ID IN (2,4))
AND ENB.SAP_ID = 'I-KA-CTPR-ENB-9016'
AND CAND.CANDIDATEID = 'C3';

1 个答案:

答案 0 :(得分:0)

我认为您已经有了查询:我是从您的第二个查询中获取的:

SELECT ENB.SAP_ID AS SAP_ID
    ,CAND.CANDIDATEID AS CANDIDATE_ID
     ,VT.*
     ,VTS.STATUS_NAME
FROM R4G_OSP.ENODEB ENB
INNER JOIN R4G_OSP.CANDIDATE CAND ON ENB.SAP_ID = CAND.SAP_ID
LEFT JOIN TBL_VSAT_MST_DETAIL VT ON ENB.SAP_ID = VT.SAP_ID
LEFT JOIN TBL_VSAT_STATUS_MST VTS ON VT.STATUS_ID = VTS.STATUS_ID
WHERE ENB.SCOPE = 'EnodeB-Connected_MW'
    AND ENB.SITEBACKHAUL = 'MW'
    AND CAND.STATUS = 'Fill Vendor Survey Form'
    AND (VT.STATUS_ID IS NULL
        OR VT.STATUS_ID IN (2, 4)
        )
    AND ENB.SAP_ID = 'I-KA-CTPR-ENB-9016'
    AND CAND.CANDIDATEID = 'C3';