7 Replies Latest reply: Sep 7, 2015 2:08 AM by Harshitha Harshu RSS

    concatenate and queries

    Henry garcia

      I'm new in Qlick.

       

      imagine 2 fact tables one of pharmacy and other of laboratory.If  they  are concatenated in a one fact table table.

       

      How do I know the patients of drug x who have a laboratory test?. 

       

      In SQL this  question  would be answered with a query between the two tables with a join. The two tables have in common only the patient identifier.

       

      Can I answer if I concatenate the two fact tables? or is necessary that they need to be seperated.

       

      Thanks.

        • Re: concatenate and queries
          Michiel van de Goor

          Concatenation will force QlikView to combine the tables, regardless of the structure and content. Equal named columns will be added in each other and unknown columns are simply added.

           

          Your patientid should have the same name and then the data wll be available per patientid.

           

          So, probably, yes.

          • Re: concatenate and queries
            Malini Chandrasekar

            Hi,

            Concatenate is used when you need to merge two or more tables that have identical structures. In the example you have explained, other than patient identifier there is no other columns identical then it is better to keep the tables separate linked to patient identifier.

              • Re: concatenate and queries
                Mike Hennigan

                Malini,

                 

                I don't believe your statment is correct.  Here is a description of Concatenate from the help text:

                 

                A concatenation is in principle the same as the SQL UNION statement, but with two differences: first that Concatenate prefix can be used no matter if the tables have identical field names or not; and secondly that no removal of identical records are made.

              • Re: concatenate and queries
                Mike Hennigan

                Check out this document.  It will help you understand the differenct between the Join and Concatenate functions.  I would like to give credit to the person who created it, but I don't remember where I got it.

                 

                Hope it helps!

                • Re: concatenate and queries
                  Henry garcia

                  Thank you very much.

                   

                  I expose an example,I think is better to can answer my question.

                   

                  Suppose a Table of pharmacy

                   

                  patient id   drug   date_pharmacy

                  1              A        20150101

                  1              B         20150203

                  2              A         20150210

                  2              A         20150705

                  2              C          20150812

                  3              A          20140312

                  4               B          20140123

                   

                  other of laboratory

                   

                  patient id  test_type   date_lab

                  1               3              20150109

                  1               7               20150206

                  3               3               20140320


                  if i concanate.



                  patient id   drug   date_pharmacy        test_type  date_lab

                  1              A        20150101

                  1              B         20150203

                  2              A         20150210

                  2              A          20150705

                  2              C          20150812

                  3              D          20140312

                  4               B          20140123

                  1                                                                3              20150109

                  1                                                                 7               20150206

                  3                                                                 3               20140320


                   

                  Can I answer, with this estructure,  the patients  of drug A , that they have a test type  3?

                   

                   

                   

                  I have a lot of Fact tables with similar estructures. Can I have two or more link tables in Qlikview?.

                   

                   

                  Thank you very much.