请问下这个查询语句怎么写? ( 积分: 50 )

J

jhddx

Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个表有 a b c 3个字段,我想在SQL语句里再弄出一个字段d,也就是 select a,b,c,...as d 这样的形式,如果a,b,c都不为空,d字段则显示 a*b*c 这样的形式(不是求他们的积!),否则d字段显示为空..怎么写???
因为不是在DELPHI程序里..只是在一个报表的查询器里写..所以不好用计算字段..请朋友们帮忙了!
 
select a,b ,c,(case when a is not null and b is not null and c is not null then 'a*b*c' else null end) as d from 表名
 
问题已解决..付上答案
谢谢下面的兄弟支持

select a,b,c,case when a<>'' then str(a)+'*'+str(b)+'*'+str(c) else '' end as abc from ...

放分!
 
顶部