10 Replies Latest reply: Mar 14, 2017 11:23 PM by Supriya R RSS

    select first and second latest record

    Supriya R

      Hi,

       

      i have Active campaigns, where expiration date is greater than today(). In this i need to build a line graph with first latest, second latest and third latest record.

       

      Below is the script

       

      LOAD `campaign_id`,

      `batch_id` ,

      `start_date` ,

      date(floor(expiration_date),'MM-DD-YYYY') as expiration_date,

          `campaign_name`;

      SQL SELECT `campaign_id`,

      `start_date`,

      expiration_date,

      `batch_meta_data_id`,

          `campaign_name`

      FROM CAMPAIGN;

       

      In front end

      sum({$< client_id={'15'},batch_id={'30'},expiration_date = {"$('>' & Date(Today(),'MM-DD-YYYY'))"}>}opened)

       

      Now i need to get sum of opened for first latest, second latest and third latest record specifically. How to get those,

       

      Any kind of help or suggestion is appreciated.