Sample Header Ad - 728x90

SQLite3 doesn't have concat_ws, looking for workaround

1 vote
2 answers
1825 views
I'm trying to concatenate some columns and I would like to use space as my output string delimiter. Basically concat_ws would be a perfect fit, but it doesn't exist for SQLite3. I'm inside a SELECT already and I'd like to end up with a string that looks like this: col1_val col2_val col3_val I have col1, col2, and col3 as my columns, and they may have empty strings as values which I'd not want to delimit. col1, is safely expected to exist, to not be NULL, and not be empty. However either col2 and col3 might be empty, and I'd thus want to skip. I've tried a few different ideas, but all of them seem to end up with double delimiters when a string is empty. So some expected results: col1_val col1_val col2_val col1_val col3_val col1_val col2_val col3_val
Asked by J. M. Becker (129 rep)
Jul 3, 2018, 04:33 PM
Last activity: Nov 11, 2024, 01:22 PM