4 Replies Latest reply on Sep 28, 2016 2:52 AM by sunaina sarah

    Combine 2 databases into a worksheet

    Michael Jo

      Hi,

      I need to union 2 tables  from 2 separate databases in SQL Server that same the field names, data type..ect..only diference thing that each database located on a location,

      for example db1 located on city A, db2 located on city B and now i need union db1+ db2 in tableau

      I try to blend data between 2 databases but it was not work properly because i need to using 2 or 3 dimensions in each database instead of a master connection only.

      Could anyone gives me some advices.


      Best regards,
      J.

        • 1. Re: Combine 2 databases into a worksheet
          Kaushik Mallampati

          Hello Michael

           

          In Tableau 10 there is a new kind of join called Cross-Database Join

           

          As the name suggests, you can perform joins from different databases into one table.

           

          Please refer Integrate Your Data with Cross-Database Joins in Tableau 10 | Tableau Software

           

           

          Regards

          Kaushik

          1 of 1 people found this helpful
          • 2. Re: Combine 2 databases into a worksheet
            Michael Jo

            @Kaushik Mallampati

             

            I tried to use that type joins but i was uable to union 2 tables, it can only inner join or left join but i think the union must be used in my case, do you know how to union multiple data souces in tableau 10?

             

            thanks,

            J.

            • 3. Re: Combine 2 databases into a worksheet
              Kaushik Mallampati

              Michael

              In Tableau 10.1 beta there are new features for more joins options and new features in Unions

              Hoping that feature will be released in 10.1 stable public version it will solve you issue.

               

              Refer this link Coming Soon

               

              Regards

              Kaushik

              3 of 3 people found this helpful
              • 4. Re: Combine 2 databases into a worksheet
                sunaina sarah

                Hi Michael,

                 

                in tableau data connections, if we are connected to two different databases or same  database from different locations/ip addr, you can only apply join condition.

                (

                for clarity-

                'Union' means where the rows from one table are appended to the rows of other table. i.e if u have 4 columns and 5 rows in each table, after union u will get 4 columns and 10 rows.

                'Join' means if u have 4 columns and 5 rows in each table, after join (if all columns are considered) then you will get 8 columns and 5 rows

                )

                But from ur question i understood that u have to append the data from two different sources.

                 

                But u will not have 'new union' option, when u are working on databases. so you cannot do union at tableau data connections.

                U will only have 'New Costume SQL' where u can write valid SQL queries. But this will work with the tables only from the database you clicked on currently(or selected currently). u cannot mix tables from database_1 and database_2.

                 

                So only thing u can do is JOIN. But i think join result is not what u need.

                 

                The only way currently to achieve union is to have an intermediate staging. U can take the data/tables from two database and save them in separate sheets of one excel, or may be create a dummy database/schema and keep the tables from different databases in to the single dummy database.

                So now as it comes from single excel sheet, if u r using excel  you can directly use 'New Union' option.

                If u are using  dummy database u can write a union statement in the 'New costume SQL' option

                 

                Regards

                Sunaina

                1 of 1 people found this helpful