14 Replies Latest reply: Aug 4, 2014 1:07 PM by Srikanth P RSS

    Joining the Intervalmatch output with main query

    Sonali Sardesai

      Hello All,

       

      While optimizing the SQL query in QlikView, i have come across a situation where i have to use intervalmatch for comparing dates from 2 tables which are not linked using any field and need to inner/left join the intervalmatch output with the main query.

       

      For eg

      Table A has 4 columns

      Emp IDStart DateEnd DateLocation ID
      101-Mar-2011null()1
      201-Jan-201223-Dec-20132
      321-May-2014null()2
      401-Apr-2011null()3
      530-Mar-201230-Mar-20145

       

      Table B has 3 Columns basically a table with all the transaction dates from 1990 till year 2019 capturing all the transactions posted to GL

      IDTransaction DateBusiness Flag
      101-Jan-2011Y
      202-Jan-2010Y
      303-Jan-2010N

       

      Both the above tables are not linked using any ID's, using interval match i need to find out the location id's of employees where the Transaction dates from table B  are between the start date and end date of table A.

      Transaction Date >= Start date and Transaction Date <= End Date.

       

      Once i get this output i need to left join it with the main query which has other employee details. How to left join this output in the main query Can anybody help?

       

       

      Thanks,

      Sonali