SQL查询在visual studio的查询窗口中返回不正确的数据,但在sql developer和sqlplus中正确的数据 这是下面的查询 QUERY WINDOW ON VISUAL STUDIO 2010 SQL DEVELOPER OUTPUT
SELECT R.COURT_NAME,
(
(SELECT SUM(NVL(RTI_DUMP.J14_AMOUNT,0) -(SITA_AMOUNT+CONSIGN))
FROM SITA_ALLOCATION ,
RTI_DUMP
WHERE RTI_DUMP.COURT_NAME =SITA_ALLOCATION.COURT_NAME AND
RTI_DUMP.NOTICE_NO =SITA_ALLOCATION.NOTICE_NO
AND UPPER(RTI_DUMP.COURT_NAME) = R.COURT_NAME
AND RTI_DUMP.CREATED_DATE ='APRIL 2015'
AND RTI_DUMP.J14_DATE <'30-APR-15'
AND SITA_ALLOCATION.CREATED_DATE='30-APR-15'
AND RTI_DUMP.J14_AMOUNT >(SITA_AMOUNT+CONSIGN)
)-
(SELECT SUM((RTI_DUMP.J14_AMOUNT) -(SITA_AMOUNT+CONSIGN))
FROM SITA_ALLOCATION ,
RTI_DUMP
WHERE RTI_DUMP.NOTICE_NO =SITA_ALLOCATION.NOTICE_NO
AND UPPER(RTI_DUMP.COURT_NAME) = R.COURT_NAME
AND RTI_DUMP.CREATED_DATE ='MARCH 2015' ----String
AND RTI_DUMP.J14_DATE <'31-MAR-15'
AND SITA_ALLOCATION.CREATED_DATE='31-MAR-15'
AND RTI_DUMP.J14_AMOUNT >(SITA_AMOUNT+CONSIGN)
)) as j14 FROM RTI_DUMP R,
SITA_ALLOCATION C
WHERE R.COURT_NAME = C.COURT_NAME
AND R.NOTICE_NO =C.NOTICE_NO
GROUP BY R.COURT_NAME
ORDER BY R.COURT_NAME;
答案 0 :(得分:0)
不要过于简单,但检查并确认您在两个环境中查看相同的连接字符串。 由于观察不同的环境,人们争论数据冲突并不罕见。例如生产和系统测试。