如何使用 And 进行选择查询
我想使用 and
条件进行选择查询。
dept, divi, comp as string
Deparment = dept
Division = divi
company = comp
尝试过此查询:
Select *
from table
where
department = '" & dept & "'
and division = '" & divi & "'
and Company = '" & comp & "'
如果 dept
、divi
、comp
值可用,则上述查询有效。
状况
如果用户仅选择部门,则应仅显示该所选部门的所有值
如果用户选择部门和公司意味着,它应该显示所选公司和该公司所选部门
如果用户选择部门、部门和公司意味着,它应该显示所选公司、该公司所选部门、该部门所选部门。
如何进行这个选择查询?
I want to make a select query with an and
condition.
dept, divi, comp as string
Deparment = dept
Division = divi
company = comp
Tried this query:
Select *
from table
where
department = '" & dept & "'
and division = '" & divi & "'
and Company = '" & comp & "'
The above query is working if the dept
, divi
, comp
values are available.
Conditions
If user select department only, it should display all value for that selected department only
If user select department and company means, it should display selected company and selected department for that company
If user select department, division and company means, it should display selected company, selected division for that company, selected department for that division.
How to make this select query?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这可能对你有帮助:
I think this may help you: