Re: [sqlite] can column name come from a table?

2013-07-29 Thread Darren Duncan
On 2013.07.29 6:08 PM, Roman Fleysher wrote: Thank you, SQLiters, for confirmation. Yes, the set up is unusual. I have a table which essentially maps existing column names to the names the users want to see. columnRenameTable(table, column, showAS) The goal was to use this mapping for

Re: [sqlite] can column name come from a table?

2013-07-29 Thread Jay A. Kreibich
> I was going to say, try using a SQL prepared statement. > > For example, in Postgres you can write something like this: > > execute format( 'SELECT %I FROM table that has that columnName', >(SELECT columnName FROM columnNameTable WHERE condition how to > select limit 1) ); > > But I

Re: [sqlite] can column name come from a table?

2013-07-29 Thread Roman Fleysher
name come from a table? On 7/29/2013 8:32 PM, Roman Fleysher wrote: > I think the answer to my question is "NO", but may be I missed something... > > Can column name come from a table, i.e. from another select? Example: > > SELECT (SELECT columnName FROM columnNameTable WHER

Re: [sqlite] can column name come from a table?

2013-07-29 Thread Darren Duncan
On 2013.07.29 5:32 PM, Roman Fleysher wrote: Dear SQLiters, I think the answer to my question is "NO", but may be I missed something... Can column name come from a table, i.e. from another select? Example: SELECT (SELECT columnName FROM columnNameTable WHERE condition how to select limit 1)

Re: [sqlite] can column name come from a table?

2013-07-29 Thread Greg Jarzab
You should be able to craft the query outside of the database and then treat it like a normal query. You have to be very careful about doing this, and it generally isn't a good idea. If you do take this approach, make sure that you properly sanitize the column names, especially if they are

Re: [sqlite] can column name come from a table?

2013-07-29 Thread Igor Tandetnik
On 7/29/2013 8:32 PM, Roman Fleysher wrote: I think the answer to my question is "NO", but may be I missed something... Can column name come from a table, i.e. from another select? Example: SELECT (SELECT columnName FROM columnNameTable WHERE condition how to select limit 1) FROM table which

[sqlite] can column name come from a table?

2013-07-29 Thread Roman Fleysher
Dear SQLiters, I think the answer to my question is "NO", but may be I missed something... Can column name come from a table, i.e. from another select? Example: SELECT (SELECT columnName FROM columnNameTable WHERE condition how to select limit 1) FROM table which has that columnName; Or this