求一sql语句! Select 标志,(case when 收付 = 1 then 金额 else 0 end) as 收金额,(case when 收付 = 0 then 金额 else 0 end) as 付金额from 表 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select 标志 ,收金额=case 收付 when 1 then 金额 else 0 end ,付金额=case 收付 when 0 then 金额 else 0 endfrom 表 order by 标志 或:Select 标志,收付 * 金额 as 收金额,(1-收付)* 金额 as 付金额 from 表-- 金额*1 = 金额 1-1 = 0 1-0 = 1 或:Select 标志,收付 * 金额 as 收金额,(1-收付)* 金额 as 付金额 from 表order by 标志-- 金额*1 = 金额 金额*0 = 0 1-1 = 0 1-0 = 1 select 标志,sum(case when 收付 =1 then 金额 else 0) as 收金额 ,sum(case when 收付 =0 then 金额 else 0) as 付金额 from a group by 标志 写错了select 标志,(case when 收付 =1 then 金额 else 0 end) as 收金额 ,(case when 收付 =0 then 金额 else 0 end ) as 付金额 from a 一个简单的行转列问题 求SQL语句 删除另一张表里没有这个字段的语句 又求数据汇总的SQL 求助sql语句 在存储过程中,怎么样截获代号547的 外键约束错误? reporting service 连接问题? 请各位高人务必救我,这个问题让我伤心很久了! 在线等候:日志文件太大了 to 大力:这个SQL 语句应该怎样写? sql查询 请教如何将某个字段的数值(文本)后增加字符串 新手提问:这样的查询如何写?
,收金额=case 收付 when 1 then 金额 else 0 end
,付金额=case 收付 when 0 then 金额 else 0 end
from 表 order by 标志
Select 标志,收付 * 金额 as 收金额,(1-收付)* 金额 as 付金额 from 表-- 金额*1 = 金额 1-1 = 0 1-0 = 1
Select 标志,收付 * 金额 as 收金额,(1-收付)* 金额 as 付金额 from 表
order by 标志
-- 金额*1 = 金额 金额*0 = 0 1-1 = 0 1-0 = 1
select 标志,(case when 收付 =1 then 金额 else 0 end) as 收金额 ,(case when 收付 =0 then 金额 else 0 end ) as 付金额 from a