Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rs
Contributor
Contributor

Select the min of the max from a subquery

Hi Qlikers,

I have a table

Events:

DeviceID, EventDate, FirmwareVersion

This table gets refreshed regularly so a new event does not correspond to a new firmware. I want to have in a table DeviceIdD vs latest firmware version vs the date it detected the firmware.

In SQL I would do it like this

 

select e.DeviceID, e.FirmwareVersion, min(e.EventDate) DateFirmwareDetected

from Events e

inner join

(

    select ev.DeviceID, ev.FirmwareVersion

    from Events ev

    inner join

        (

        select DeviceID, max(EventDate) EventDate

        from Events

        group by DeviceID

        ) a

    on ev.DeviceID = a.DeviceID and ev.EventDate = a.EventDate

) b

on e.DeviceID = b.DeviceID and e.FirmwareVersion = b.FirmwareVersion

 

Can anybody help with putting this in Qlik?

 

Thanks

Labels (3)
1 Reply
sunny_talwar

Would you be able to share a sample of data and the output you expect to see from it?