8 Replies Latest reply: Oct 27, 2014 5:47 AM by Robert Skytt RSS

    compare data from columns in different tables

      Hi all!

       

      I'm new to QlikView, please go easy on me =)

       

      I'm used to T-SQL and BI and I can easily explain what I need to do but I have such limited knowledge in QlikView scripting that things get confusing. So here's a small example of what I'm trying to do. If you can point me to documenation regarding ETL I'm much grateful.

       

      I'm trying to find a way to compare dates for every row in the two tables to be able to calculate the average number of days of the selection I make later in the application.

       

      In T-SQL I would do it like this:

      SELECT

        A.StartDate

        , B.EndDate

        , DATEDIFF(DAY, A.StartDate, B.EndDate) AS NumberOfDays

      FROM

        TableA AS A

        INNER JOIN TableB AS B

        ON A.ID = B.ID;

       

      In QlikView I managed this far:

      SQL SELECT

             ID

           , StartDate

      FROM TableA;

       

      INNER JOIN(TableA)

       

      SQL SELECT

           ID

           , EndDate

      FROM

           TableB;

       

      Now I wonder how I can compare the two dates in the different tables. Should i do this in the load script?