sqlserver
select FNumber,
(
case
when FAmount>0 then FAmount
else 0
end
) as Income,
(
case
when FAmount<0 then ABS(FAmount)
else 0
end
)as Outcome
from Test_1
下面是截图:
还有一些sql语句的使用:
1分组:
select 字段名,count(*) from 表名
group by 字段名
比如:select FAge,count(*) from T_Users
group by FAge
2删除:
delete from表名 条件
比如:delete from T_Users where age<18,age<18就是条件。
3排序:
select * from 表名
order by 字段名
比如:select * from T_Users order by FAge desc