Orderby IN sql语句 [英] Orderby IN sql Statement
本文介绍了Orderby IN sql语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮助我
我正在vb 6中使用Access数据库
我想在带有可变值的选择命令中按条件排序
exp
将dim的sortonname设为Boolean
我想根据变量是否为true排序
按名称订购,否则默认为
please help me
i am working with access database in vb 6
i want to conditional order by in select command with a varriable value
exp
dim sortonname as Boolean
i want to order by according to varriable if true then
order by name else default
select * from students iif(sortonname=true,order by name,order by city(default))
推荐答案
Don'无法进行测试,但是您可以尝试类似
的方法
Don''t have access at hand to test this, but you could try something like
select * from students order by iif(sortonname=true, name, city)
排序,假设您设置了sortonname
作为VB变量,将其作为参数传递给Access(下面的@SortOnName),然后尝试以下操作:
Assuming that you setsortonname
as a VB variable, pass it though to Access as a parameter (@SortOnName below) and try this:
IF @SortOnName=0
SELECT * FROM students ORDER BY city
ELSE
SELECT * FROM students ORDER BY name
这篇关于Orderby IN sql语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文