SQLite Forum

pivot requery SQLITE
If you are asking how to write a SELECT statement that produces a different number of columns depending on the contents of the database, then you cannot - SQL doesn't work this way. The number and names of columns are determined by the query structure alone; only the number of rows depends on the data.