各位大侠 这条sql语句 能不能用 iff 或者 case when 改写?access数据库sql="Select * From FoodClass Where ClassIdx=0 Order By FoodClassSort,ClassID Desc Union All Select * From FoodClass Where ClassIdx<>0 Order By FoodClassSort,ClassID Asc"ClassIdx=0 降序 ClassIdx<>0 升序
解决方案 »
- 急、、、多表查询插入哪错了??
- 简单的 sql语句。查询列表
- 求一sql语句,删除表中重复记录
- 在存储过程中如何判断01字符串中1的位置呢?
- 关于数据库设计过程
- 错误:You have an error in your SQL syntax;
- there is a stored procedure create procedure CreateHuman
- 来公司也快两年了,今天才加一次工资!高兴,但还是有磁盘镜像的问题想问问?
- 如何获得查询(更新)了数据库中的哪些表?
- SQL 2008 R2 提示SQL Server Management Studio 无法加载软件包
- 表内联查询问题
- 急急急,sql查询效率问题
具体可以看我的文章:http://blog.csdn.net/dba_huangzj/article/details/7684520
order by case when f1=0 then 1 else 0 end,f2 // f1==0的,排最后
或
order by case when f1=0 then -f2 else f2 end // f1==0的,f2降序,否则f2升序