考虑这个表格: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)
这会产生一个错误:
在此上下文中不允许子查询。只允许标量表达式。
我该如何使用另一个表格的列作为输入来计算这个计算列的值?
NewColumnName
列时,该函数将被调用并计算出相应的值。 - marc_s