2 Replies Latest reply on Jan 31, 2016 4:15 AM by usman_noshahi

    SQL Results question

    3164078

      I have a this query:

      select

            n.name_first,

            n.name_last,

            nd.detail_id,

            case when nd.detail_id = 'D00067229621' then nd.data end as Confirmation,

            case when nd.detail_id = 'D00067229821' then nd.data end as Submit_Date,

            no.enter_date

      from sc_base.name n

       

      inner join sc_base.hcfa_name_org no on

      n.name_id = no.name_id

       

      inner join sc_base.name_detail nd on

      no.name_id = nd.name_id

      and nd.detail_id in ('D00067229821','D00067229621')

       

      where no.enter_date between '1-JAN-2016' and '20-JAN-2016';

       

      Result:

      NAME_FIRST    NAME_LAST    DETAIL_ID    CONFIRMATION         SUBMIT_DATE                  ENTER_DATE

      Joe                       Smith         D00067229821    NULL                       2016-01-06T09:59:56.    06-JAN-16

      Joe                       Smith         D00067229621    17527597                 NULL                            06-JAN-16

       

      Desired result:

      NAME_FIRST    NAME_LAST    DETAIL_ID              CONFIRMATION         SUBMIT_DATE                  ENTER_DATE

      Joe                      Smith              D00067229621         17527597                2016-01-06T09:59:56         06-JAN-16

       

      Thank you in advanced.