基于SQL语句向组合框添加其他选项 [英] Adding additional options to combo box based on SQL statement
本文介绍了基于SQL语句向组合框添加其他选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
假设我有一个链接到以下SQL语句的组合框:" SELECT DISTINCT Column1 FROM Tbl1;"
假设结果是3个字段:红色,绿色,黄色
如果我想在此列表中添加一个额外的字段(例如,蓝色)怎么办,尽管它没有''' t出现在表中?我知道我可以自己键入值,但我希望组合框看起来是表(动态/更改),并添加一些额外的选项。
任何建议是非常感谢。
Hello,
Suppose I have combo box that is linked to the following SQL statement: "SELECT DISTINCT Column1 FROM Tbl1;"
Suppose the results are 3 fields: Red, Green, Yellow
What if I wanted to add an additional field (say, Blue) to this list, although it doesn''t appear in the table? I know I can type in the values myself, but I want the combo box to look the table (which is dynamic/changing), and add a few additional options.
Any advice is very much appreciated.
推荐答案
我过去做了什么,我不知道是否有更好的方法,但我 UNION ALL 我想要的价值。
首先,我创建了一个名为 DUAL 的虚拟表(它是一个oracle的东西),它有只有一列而且没有值。
其次,我这样写我的查询:
What I have done in the past, and I don''t know if there is a better way, but I UNION ALL the values I want together.
First, I created a dummy table called DUAL (it''s an oracle thing), that has only one column and no values in it.
Second, I write my query as such:
展开 | 选择 | 换行 | 行号
这是一个好主意,我相信它会奏效。谢谢AJ。
That''s a great idea and I''m sure that will work. Thanks AJ.
实际上你不需要创建一个虚拟表,你可以在那里使用别名。
这应该有效:
Actually you dont need to create a dummy table, you can alias the value in there.
This should work:
展开 | 选择 | Wrap | 行号
这篇关于基于SQL语句向组合框添加其他选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文