Skip to Content
avatar image
Former Member

Issue with inner join

Hi,

Can some one explain me this issue

SELECT COUNT(*) FROM "ECCDATA"."CUST1"  O/P = 800

SELECT COUNT(*) FROM "ECCDATA"."CUST1"  WHERE MANDT = '800' O/P = 800

SELECT COUNT(*) FROM "ECCDATA"."CUST2"  O/P = 13779

SELECT COUNT(*) FROM "ECCDATA"."CUST2"  WHERE MANDT = '800'    O/p = 13751

SELECT COUNT(*) FROM ( SELECT T1."A1", T2."MANDT" FROM "ECCDATA"."CUST1" AS T1

INNER JOIN  "ECCDATA"."A2" AS T2

ON T1."A1" = T2."A1" AND

   T2."MANDT" = '800' )      O/P = 13783


SELECT COUNT(*) FROM ( SELECT T1."A1", T2."MANDT" FROM "ECCDATA"."CUST1" AS T1

INNER JOIN  "ECCDATA"."A2" AS T2

ON T1."A1" = T2."A1" AND

   T1."MANDT" = T2."MANDT")      O/P = 13779

Thanks

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 10, 2014 at 07:17 AM

    May be you can figure it out yourself with:

    SELECT * FROM

    ( SELECT T1."A1", T2."MANDT" FROM "ECCDATA"."CUST1" AS T1 INNER JOIN "ECCDATA"."A2" AS T2 ON T1."A1" = T2."A1" AND T2."MANDT" = '800'

      minus

      SELECT T1."A1", T2."MANDT" FROM "ECCDATA"."CUST1" AS T1 INNER JOIN  "ECCDATA"."A2" AS T2 ON T1."A1" = T2."A1" AND T1."MANDT" = T2."MANDT"

    )

    There could be some values for MANDT which could be null or ' ' (empty string).

    The above select statement will help identify such records. You can also reverse the sequence of the select statements to identify any other discrepancies.

    Ravi

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 10, 2014 at 07:19 AM

    Also, please don't ask the same question on multiple forums. It is against the forum policy.

    Ravi

    Add comment
    10|10000 characters needed characters exceeded