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!

Query output need to be changed

Discussion in 'SQL PL/SQL' started by Gautam Roy, Dec 26, 2017.

  1. Gautam Roy

    Gautam Roy Starter

    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    10
    Location:
    India
    Hi
    there are TWO tables as below
    USER_DATA_B
    1>USER_ID
    2>CUST_ID
    3>CREATE_DT
    4>LOG_ID

    USER_LOGON_ID_CHANGE_B
    1> ID
    2>USER_ID
    3>NEW_LOGON_ID
    4>OLD_LOGON_ID
    5>OLD_CREATE_DT
    6>ROW_CREATE_DT

    the existing query to show the details in UI is as below

    SELECT USER_ID,OLD_CREATE_DT,ROW_CREATE_DT FROM USER_LOGON_ID_CHANGE_B WHERE OLD_LOGON_ID=?
    AND NEW_LOGON_ID IS NULL
    UNION
    SELECT USER_ID,CREATE_DT,NULL FROM USER_DATA_B WHERE LOG_ID=?
    ORDER BY OLD_CREATE_DT


    Now, my requirement is to join the above query with the following table
    CUSTOMER_ATTRIBUTE_B
    1>CUST_ID
    2> ATTRIBUTE_TYPE_CD
    3>ATTRIBUTE_DATA

    The new query output should be below
    1>USER_ID
    2>OLD_CREATE_DT,
    3>ROW_CREATE_DT
    4> ATTRIBUTE_TYPE_CD
    5>ATTRIBUTE_DATA

    Please assist me to solve the issue

    regards
    gautam
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,619
    Likes Received:
    364
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You've asked this in the Oracle forums; see what responses you get there.

    I monitor both this and Oracle.
     
  3. vibhasss

    vibhasss Active Member

    Messages:
    7
    Likes Received:
    2
    Trophy Points:
    160
    Location:
    India
    SELECT
    UDB.USER_ID
    ,ULCB.OLD_CREATE_DT
    ,ULCB.ROW_CREATE_DT
    ,CAB.ATTRIBUTE_TYPE_CD
    ,CAB.ATTRIBUTE_DATA
    from
    USER_DATA_B UDB,
    USER_LOGON_ID_CHANGE_B ULCB,
    CUSTOMER_ATTRIBUTE_B CAB
    WHERE
    UDB.USER_ID = ULCB.USER_ID
    AND UDB.CUST_ID = CAB.CUST_ID

    Add whatever more conditions you need...