How to build a JOIN condition from 2 Scala sequences?

We have 2 sequences. Each of them contains the columns that should be used to make a JOIN between 2 different tables in a database. How to create this query with Scala?

First, we'll need a function called transpose which is able to combine 2 sequences:

    val columns1 = Seq("a.col1", "a.col2", "a.col3")
    val columns2 = Seq("b.col1", "b.col2", "b.col3")

    val combinedCols = Seq(columns1, columns2).transpose

    combinedCols should have size 3
    combinedCols should contain allOf(List("a.col1", "b.col1"),
      List("a.col2", "b.col2"), List("a.col3", "b.col3"))

What happens if you have different number of columns? Like:

    val columns1 = Seq("a.col1", "a.col2", "a.col3")
    val columns2 = Seq("b.col1", "b.col2")

    val combinedCols = Seq(columns1, columns2).transpose

Well, simply it fails since transpose doesn't accept different size of collections:

transpose requires all collections have the same size
java.lang.IllegalArgumentException: transpose requires all collections have the same size