Using field value as part of expression??

37 views
Skip to first unread message

Rinse Lemstra

unread,
Jan 21, 2022, 3:17:30 AM1/21/22
to H2 Database
Suppose the field 'Abbr'  does contain the value "ABC" and here is also a field with the name "ABC_budget".

Is there an SQL expression possible to get the value of field ABC_budget using the contents of field Abbr ?

Thanks in advance

Evgenij Ryazanov

unread,
Jan 23, 2022, 2:33:19 AM1/23/22
to H2 Database
Hello!

Do you want to read a column name from some different column and read the value of a column with that name immediately? It isn't possible. You can only read this name and construct a new query to read the value.

If database schema requires such operations, it has serious design flaws and it needs to be properly normalized.

Reply all
Reply to author
Forward
0 new messages