How to concatenate a selection of sqlite columns spread over multiple tables?

concatenation, sqlite

Solution

Try this

SELECT a.col1 || a.col2 ||  b.col3 AS 'SUM'
FROM table1 a, table2 b
WHERE a.id = b.id;

In where you have top mention the joining condition between the tables

Fiddle

Problem

I am aware that you can concatenate multiple columns within a single table with a query like this: ``` SELECT ( column1 || column2 || column3 || ... ) AS some_name FROM some_table ``` Is it possible to concatenate columns from multiple tables with a single sqlite query? Very simple example - Two tables and the result: ``` Table1 | Table2 | Result Col1 Col2 | Col3 | ------------------------------------------------------------------------------- A B | C | ABC ``` If this is possible, what would the query be? I can always manually concatenate multiple single table concatenation results, but having sqlite do all the work would be great:)

Original source