1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

compare multiple rows

Discussion in 'Oracle Financials' started by rajendraibm@gmail.com, Nov 6, 2013.

  1. hi,
    i have 2 table example: A with num,name and B with num_fk,code(where num_fk is num from table A)
    data is like below:
    A
    ---
    num name
    1 rrr
    2 ffff
    3 dsdfddd

    B
    ---
    num_fk code
    1 a
    1 b
    1 c
    1 g
    1 h
    1 k
    1 a
    2 b
    2 c
    2 g
    2 h
    2 m

    .....

    now i want to validate query like.....

    from table B having a and k based on num_fk on..this is only sample..table may have thousands of records..
    i need to get the results like..
    which num_fk have code "d" and also have "c"
    which num_fk have code "d" and does not have "c"
    which num_fk does not have code "d" and have "c"..like that...

    i tried with in but not useful in my case.
    please let me know with exists and not exists in same query or better options please..

    thanks
    Raj