sqlite3 - SQLite how to refer to column name by a query -
what want
select (select fields tableb interest=yes) tablea
why can not this? workaround?
example: got tablea this
time|c1|c2|c3 --------------- 0.0 |1 |11|111 1.0 |2 |22|222 2.0 |3 |33|333
tableb this
field| interes -------------- c1 |yes c2 |yes c3 |no
i want able put command this
select (select field tableb interest=yes) tablea time=1.0
that gives me
2|22
heart of issue not let me refer column_names query result. :(
i'm guessing little have written want variable list of fields (where list of fields retrieved tableb
) retrieved tablea
.
this isn't possible directly in sql. need make 2 calls, first 1 retrieve list of fields, , second 1 have generated sql statement exoplicit list of fields first call.
Comments
Post a Comment