0

I would like to make the name of a column dependent on a subquery in a MySQL SELECT call, but I don't know how to build the call.

example:

SELECT ts AS time, Temperatur AS (SELECT Name FROM SensorInfo WHERE id=8)
FROM Sensoren
WHERE id = 8;

The "SensorInfo" table contains the name that should be used as an alias for "Temperature". Of course, this call doesn't work. I'm trying to demonstrate what I'm trying to do. How can I implement this?

  • Does this answer your question? [How to select column names dynamically in mySQL](https://stackoverflow.com/questions/15507683/how-to-select-column-names-dynamically-in-mysql) – Aarlaneth Oct 26 '22 at 06:42

0 Answers0