How to frame a Query for this scenario ?

Discussion in 'Oracle' started by aggiridharan, May 11, 2007.

  1. aggiridharan

    aggiridharan New Member

    Joined:
    May 11, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    I have two tables T1 and T2. T1 contains transaction details with say date, oper_id, super_id, tran_no where oper_id and super_id are user id types used for posting/authorising the transactions.
    T2 contains user_id and user_name. There could some users with more than one user_id as well ( ie the names are same with ids different)

    Now, i want to find out all the transactions from T1 where oper_id and super_id correspond to same person (ie they have same user name in T2) . The assumption is all the users have distinct names.
     
  2. Parimal

    Parimal New Member

    Joined:
    May 4, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    bekar
    Location:
    pagalkhana
    hi
    this could solve your problem

    select t1.* from t1,t2 as x, t2 as y
    where t1.op_id=x.uid
    and t1.sp_id=y.uid
    and x.uname=y.uname
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice