0 Replies Latest reply: Jul 21, 2017 7:54 AM by Carotenuto Massimiliano RSS

    Max Value

    Carotenuto Massimiliano

      Hello All,

       

      I've have a question for you, basically i have to reproduce the same query SQL in QlikSense:

       

      Select

      s.shipment_id,

      s.request_id,

      su.serial_id,

      ( select max(ru1.request_unit_id)

        from request_unit ru1

        where ru1.serial_id = su.serial_id

          and ru1.created_dttm < su.created_dttm ) last_repaired_unit

       

       

      from shipment s

      , shipment_unit su

       

       

      where 1 = 1

      and s.shipment_id = su.shipment_id

      and su.serial_id ='14277PP20385546'

      and s.shipment_id='1505885'

       

      result:

       

      shipment_id     request_id     serial_id                      last_repaired_unit

      1505885          167026          14277PP20385546     2103472

       

       

      To be clear i have 2 table:

      SHIPMENT_UNIT:

           shipment_id

           serial_id

      REQUEST_UNIT

           serial_id

           request_unit_id

       

      In this method i will have for one serial number more than one request_unit_id and i need only the max value of this filed.

       

      Is possible to do that? thank You Massimiliano