You can do this in the CLI using .once and .read .once /tmp/aaa.sql select 'select ' || group_concat(name) || ' from mytable' from pragma_table_info('mytable') where substr(name,1,7)='PREFIX_'; .read /tmp/aaa.sql
You can do this in the CLI using .once and .read .once /tmp/aaa.sql select 'select ' || group_concat(name) || ' from mytable' from pragma_table_info('mytable') where substr(name,1,7)='PREFIX_'; .read /tmp/aaa.sql