locked
Compare the value from 2 table RRS feed

  • Question

  • User-721945135 posted

    Hi,

    I have 1 query which will combine 2 table, Table_A and Table_B to get result by using inner join.

    Table_A
    Name Bin_Num
    Math_1 11000
    Math_2 00010
    Math_3 00001
    Math_4 00110
    Math_5 00000
    Table_B
    Name Bin_Num
    Math_1 01010
    Math_2 00010
    Math_3 00000
    Math_4 01100
    Math_5 00000


    Both Bin_Num columns are get by using "MAX(substr(BINARY, 1, 1)) || MAX(substr(BINARY, 2, 1)) || MAX(substr(BINARY, 3, 1)) || MAX(substr(BINARY, 4, 1)) || MAX(substr(BINARY, 5, 1))".

    I want to compare the value in Bin_Num column from Table_A and Table_B, if Bin_Num of Table_A is "0" and Bin_Num of Table_B is "1" then the row will be display, example as show below:

    Table_A, Table_B ==> Result
    11000 , 01010 ==>display (1,0 at 1st position but 0,1 at 4th position )
    00010 , 00010 ==>ignore (1,1 at 4th position)
    00001 , 00000 ==>ignore (1,0 at 5th position)
    00110 , 01100 ==>display (0,1 at 2nd position)
    00000 , 00000 ==>ignore (0,0 at both side)


    Please guide me how to compare..
    Millions Thanks in advance.

    Sunday, December 11, 2011 8:22 AM

All replies

  • User269602965 posted

    I guess you have not had much response

    because folks are not understanding the business rules being applied to "RESULTS"

    nor the purpose of such an exercise.

    Tuesday, December 13, 2011 12:18 PM