3 Replies Latest reply: Nov 13, 2012 10:19 AM by Gysbert Wassenaar RSS

    Join two tables

      Hi there qlikview community,

       

      I am new to Qlikview and i am trynig to join to tables. So there it is

       

      NV200_Boundaries:

      LOAD          Validator,

                          Sensor,

                          High,

                          Low;

      SQL SELECT *

      FROM `list_a`.`initlimits`;

       

       

       

       

      NV200_Data:

      LOAD          TestID,

                          TestDate,

                          SensorName,

                          SensorParam,

                          SensorValue;

       

      SQL SELECT

                          SensorStats.TestID,

                          SensorStats.TestDate,

                          SensorValues.SensorName,

                          SensorValues.SensorParam,

                          SensorValues.SensorValue

      FROM `office_a_log`.`nv200_init_sensor_header` AS SensorStats

      JOIN `office_a_log`.`nv200_init_sensor_log` AS SensorValues

      ON SensorStats.TestID = SensorValues.TestID;

       

      I would like to join the tables nv200_boundaries and nv200_data in the key Sensor of the first table which is the same as  Sensor name on the second table. Any help appreciated.

        • Re: Join two tables
          Gysbert Wassenaar

          Rename Sensor to SensorName so qlikview can associate the two tables on that field:

           

          NV200_Boundaries:

          LOAD          Validator,

                              Sensor as SensorName,

                              High,

                              Low;

          SQL SELECT *

          FROM `list_a`.`initlimits`;

          • Re: Join two tables
            Yaseen Pullissery

            If you want to join (not associate) then you can write this LOAD statement :

             

            INNER JOIN (NV200_Boundaries)

            LOAD

            TestID,

            TestDate,

            SensorName AS Sensor,

            SensorParam,

            SensorValue

            RESIDENT NV200_Data;

             

            OR

             

            Modfiy the second load statement as follows :

             

            INNER JOIN (NV200_Boundaries)

            LOAD          TestID,

                                TestDate,

                                SensorName AS Sensor,

                                                  SensorParam,

                                SensorValue;

             

            SQL SELECT

                                SensorStats.TestID,

                                SensorStats.TestDate,

                                SensorValues.SensorName,

                                SensorValues.SensorParam,

                                SensorValues.SensorValue

            FROM `office_a_log`.`nv200_init_sensor_header` AS SensorStats

            JOIN `office_a_log`.`nv200_init_sensor_log` AS SensorValues

            ON SensorStats.TestID = SensorValues.TestID;

             

            I hope this helps!

             

            MultiView