考虑这张表:c_const
code | nvalue
--------------
1 | 10000
2 | 20000
和另一张桌子t_anytable
rec_id | s_id | n_code
---------------------
2 | x | 1
目标是s_id
成为一个计算列,基于以下公式:
rec_id*(select nvalue from c_const where code=ncode)
这会产生一个错误:
在这种情况下不允许子查询。只允许标量表达式。
如何使用另一个表的列作为输入来计算此计算列的值?