Combine columns in Visual SQL

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

There may be scenarios where you want to combine values from multiple columns to create your desired chart. Since Visual SQL steps recognize standard SQLite expressions, you can use the || operator, which allows you to concatenate (combine) values. You can also add additional text to the new column by including the text in single quotes.

In this example, we want to combine the “First Name” and “Last Name” column to create a column that combines the two values.

(Auto-migrated image: description temporarily unavailable)

To combine the columns in Visual SQL:

  1. Select the “Formula column” step above the result table and choose Custom as the formula type.

  2. Enter the following formula to combine the two columns with a space in between the two column values:

1 "First Name"||' '||"Last Name"

Be sure to wrap column names in double quotes and static string in single quotes in your custom formula.

(Auto-migrated image: description temporarily unavailable)

Solution

Combining columns with null values

When using a “Formula column” step to combine two columns, the combined column will be blank if one of the columns is null. This is because concatenation ignores a null column and doesn’t show it in the result.

(Auto-migrated image: description temporarily unavailable)

To address this, you can use a CASE statement formula in an “Apply formula” step prior to combining the columns.

For this example, if there are any null values for “Last Name”, we want to fill it with the string ' '. Here’s what that CASE statement would look like:

1 CASE WHEN "Last Name" IS NULL THEN ' ' ELSE "Last Name" END
(Auto-migrated image: description temporarily unavailable)

Now any null values in the “Last Name” column are filled with a blank space. This enables us to combine the values in all the rows when combining columns.

(Auto-migrated image: description temporarily unavailable)
Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.