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 has that columnName;
The answer to your question is, indeed, "NO". I mean, the query you show
is legal, but does something quite different from what you want.
Or this is not doable within SQL and I must execute internal select separately
and have application compose second (external) select?
Yes. Note that your design is extremely unusual. Replace that wide table
that you want to index by column name with a narrow table having a
ColumnName column, and original column names as values. Then you can write
select Value from MyNarrowTable where ColumnName in
(select columnName from columnNameTable ...);
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users