mercredi 5 octobre 2016

SELECTing the column names for another SELECT - possible?

I have a table t1 with a 'foo' column, and records containing 'bar' and 'baz' in column 'foo'. I also have a table t2 with columns 'bar', 'baz' and 'quux'. I want to do something like the following:

SELECT (SELECT foo from t1) FROM t2;

that is, get the two column names from t1 and query those columns of t2. If I try to do this with MonetDB, I get an error message:

cardinality violation (2>1)

so,

  • is there some other way to do this with MonetDB?
  • is this possible in MySQL? other DBMSes?




Aucun commentaire:

Enregistrer un commentaire