一张表“ORDERS” 字段 a b c d e f g h如果 d字段值不为空 则查询结果显示 a d e f g h 否则 显示a b c f g h该怎么弄?
解决方案 »
- 么解决:sql2005无法连接远程sql2000,登录失败,错误18456
- 如何根据其它输入列的值作为条件,自动写入列值,如何实现??????
- 在触发器中如何判断删除一条纪录和多条纪录或者没有删除任何纪录
- access 里的Update Member Set VIP=Not VIP在sql2000中应写作...
- 求一句Sql
- 合并2个结果集
- 求sql 或存储过程,谢谢各位大侠
- 语句问题
- VB.NET怎么向text字段中写入回车换行符?类似C中“\n”
- 关于Access和Visual FoxPro的比较,各位有什么建议?
- 为了使多个客户机存取访问服务器数据库不产生并发冲突问题,是否尽量少用或不用全局的记录集变量?就是避免使用以下象这样的Public变量对吗?
- 简单的问题,送分了,22点结贴.123(ee)这样的列如何提取出123
if exists(select 1 from ORDERS where d is null)
select a,b,c,f,g,h from ORDERS
else
select a,d,e,f,g,h from ORDERS如果有多行的话楼主想怎样显示数据?
CASE d IS NULL THEN c ELSE e END AS Column2,
f,g,h
FROM ORDERS
[col1]=a,
[col2]=case when d is not null then d else b end,
[col3]=case when d is not null then e else c end,
[col4]=f,
[col5]=g,
[col6]=h
from
t
select a,case when d is null then b else d end,case when d is null then c else e end,f,g,h from orders