---
title: "How to make an unconditional join in Redshift"
description: "LEFT OUTER JOIN ON 1=1 in Redshift"
author: "Bartosz Mikulski"
author_bio: "Principal AI Engineer & MLOps Architect. I bridge the gap between \"it works in a notebook\" and \"it works for 200 million users.\""
author_url: https://mikulskibartosz.name
author_linkedin: https://www.linkedin.com/in/mikulskibartosz/
author_github: https://github.com/mikulskibartosz
canonical_url: https://mikulskibartosz.name/unconditional-join-in-redshift
---

Sometimes we need a weird kind of join operation, something that returns all of the values from the "left" table cross joined with all of the rows from the "right" table. However, it is not a cross join because the cross join would skip the not matched rows from the "left" table.

In such situations, we use a weird SQL expression that looks like this `left_table LEFT OUTER JOIN right_table ON 1=1`. What does it do? It returns the `true` for every combination of rows from both tables, so all rows from left_table will be matched with all rows from right_table. It is almost like a CROSS JOIN, but it will return everything from the left_table even if the right_table is empty.

Note that, in Redshift (and Postgres and any other database based on Postgres), we can make this expression more readable by typing `left_table LEFT OUTER JOIN right_table ON true`, which, in my opinion, makes the intent more explicit.

