0

I am using Carto Builder and I have two datasets with exactly the same column headings but each dataset has different data under each column heading.

Is there a way to merge the data without creating a new column heading each time. I've been using the Merge Datasets function but can't find a way to avoid creating a new column each time.

enter image description here enter image description here

As you can see they have the same column names and I just want to merge the data below all into one whole table.

0

1 Answer 1

1

Open any dataset (from your Dataset dashboard, instead of doing it in BUILDER) and apply the following SQL query:

WITH data as (
  SELECT
    the_geom,
    _end,
    ...
  FROM
    table_name1
  UNION ALL
  SELECT
    the_geom,
    _end,
    ...
  FROM
    table_name2)
SELECT *, row_number() over() as cartodb_id FROM data

You will need to replace ... with the rest of your field names (except cartodb_id). Finally, after applying you would need to Create a new dataset from query....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.