How to join to a table multiple times?
I'm struggling to replicate a simple type of join my company does all the time in SQL Server within a Domo DataSet view. Perhaps this isn't possible to do yet. I'm hoping someone can help out.
Attached photo which has most of the complexity removed, but shows what I'm trying to do. We see "Transactions" in one table, and "Transaction_Contacts" (the buyer and seller involved in each transaction) in the other. Each transaction has 1 buyer and 1 seller.
In SQL Server, I use "table aliases" to JOIN to the Transaction_Contacts table TWICE. I use "column aliases" to rename the output columns, to become "SellerName" or "BuyerName" as appropriate. The output shown at the bottom is what the customers are expecting to see.
This is easy in SQL Server, as shown in the sample code at the bottom. When I try to create a Domo Dataset View, I can join the "Transaction_Contacts" table once, but if I try to add it again. it's greyed out/disabled. Does anyone know why? Is there a better way to do this? (I'm sure I could create an ETL but would like to avoid the complexity if possible due to understaffing.
Answers
-
You could create two contacts views. One filtered by buyers and one by sellers then join them both to your main dataset
I'm quite new to domo so someone may have a better way.
1 -
If you want to do this just using views, then I think @Jones01 has the right idea. Depending on how many joins you want to do, this might get just as complex as just using an ETL. You could try doing this using a SQL dataflow as that might provide you with a little more familiarity with the process, but depending on the number and complexity of the joins, that could take a long time to run.
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**
2 -
I am able to create multiple views of the same dataset, such as "View_Sellers" and "View Buyers", then join that to Transactions. Only issue there is that Domo doesn't distinguish which field is from which table. It just appends a number to the column name automatically. For example, "First Name", "Last Name", Contact ID", then "First Name 1", "Last Name 1", "Contact ID 1".
To get around this, In "View Sellers" and "View Buyers" view, I have renamed all columns with a prefix, such as "Seller_First_Name", "Buyer_First_Name", etc. It's messy, but I think it will work until Domo allows multiple joins to the same table.
0 -
I would encourage you to explore some of the other transform tools that Domo offers. Not all problems can be solved with the same tool. In this case, if you join the data with either an ETL or SQL dataflow, you will have much more control over the join. The join mechanic for dataset views is meant for very simple joins.
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman2
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive