Collapse and Merge Columns
Hi, I'm trying to join two datasets together with a single shared field. I can do this just fine, but I'd like to collapse one column from both datasets into the same column and leave the rest of the columns intact. Below is an example of the column I'm trying to combine. I don't want to do a straight append though because the name column will show a ton of blanks (unless there's something I can do about that). Thoughts?
Comments
-
MySQL dataflow:
SELECT
a.`ID`
,a.`Name`
,a.`Description`
,a.`Value 1`
,a.`Value 2`
,b.`Value 3`
FROM `Dataset 1` a
LEFT JOIN
`Dataset 2` b
ON a.`Description`=b.`Other Description`Let me know if you prefer an ETL transform
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman0 -
This would work for a regular join but `Description` and `Other Description` will never match. I basically want to append the `Other Description` onto the first dataset table but also bring over all of the other columns.
0 -
You mean like a union?
try:
SELECT
a.`ID`
,a.`Name`
,a.`Description`
,a.`Value 1`
,a.`Value 2`
,null as `Value 3`
FROM `Dataset 1` a
UNION
SELECT
b.`ID`
,b.`Name`
,b.`Other Description` As `Description`
,null as `Value 1`
,null as `Value 2`
,b.`Value 3`
FROM `Dataset 2` b
“There is a superhero in all of us, we just need the courage to put on the cape.” -Superman0 -
I think I was just able to get this to work using both methods.
SELECT
a.`ID`
,a.`Name`
,a.`Description`
,a.`Value 1`
,a.`Value 2`
,'' as `Value 3`
FROM `Dataset 1` a
UNION ALL
SELECT
b.`ID`
,a.`Name`
,b.`Other Description` As `Description`
,'' as `Value 1`
,'' as `Value 2`
,b.`Value 3`
FROM `Dataset 2` b
LEFT JOIN `Dataset 1` a ON b.ID=a.ID
WHERE b.`Other Description` IS NOT NULL1
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.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 58 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 395 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 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