Firebird从表a或b中选择数据 [英] Firebird select data from table a or b
本文介绍了Firebird从表a或b中选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个项目,该项目显示了从Firebird数据库构建的HTML文档.在单独的文件中,我有SQL查询.在这种情况下,如何从表a或表b中获取数据?
I am working on a project which shows HTML documents constructed from a Firebird database. In separate files, I have SQL queries. How can I get data from table a, or b in this case?
例如:
Declare varID int = __docid__;
select fielda, fieldb AS fieldbv from
if(varID = 10) then tableA;
else tableB;
推荐答案
您可以将存储过程与参数varId
一起使用.
在此过程中,从表A和B中获取值,检查参数并返回所需结果.像这样:
You may use stored procedure with parameter varId
.
In this procedure get the values from table A and B, check the parameter and return desired result. Something like:
if (:varId = 10) then
Select fieldA from tableA where ... into :OutParam;
else
Select fieldB from tableB where ...into :OutParam;
Suspend;
在您的项目中,只需使用参数varId
调用此过程即可.
From your project just call this procedure with param varId
.
这篇关于Firebird从表a或b中选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文