请教怎样将几个不同表格的数据放在一个公式中计算并将结果显示在edit中
请问怎样将几个不同表格的数据放在一个公式中计算并将结果显示在edit中
例如表1
字段: id zc zj gl
表2
字段: id lx zf df
表3
字段: id gb gbje
公式 (表1.zc+表2.lx+表2.df)/gb
gb首先提取表3.gb,若表3.bg为空值或者为0,则提取表3.gbje.
最后将结果显示到edit中
------解决方案--------------------
select (t1.zc+t2.lx+t2.df)/(case when t3.gb is null or t3.gb=0 then t3.gbje else t3.gb end) rst
from t1,t2,t3 where t1.id=t2.id and t1.id = t3.id
例如表1
字段: id zc zj gl
表2
字段: id lx zf df
表3
字段: id gb gbje
公式 (表1.zc+表2.lx+表2.df)/gb
gb首先提取表3.gb,若表3.bg为空值或者为0,则提取表3.gbje.
最后将结果显示到edit中
------解决方案--------------------
select (t1.zc+t2.lx+t2.df)/(case when t3.gb is null or t3.gb=0 then t3.gbje else t3.gb end) rst
from t1,t2,t3 where t1.id=t2.id and t1.id = t3.id