日期:2014-05-18  浏览次数:20491 次

怎么获取金额那些是正数,那些是负数
请问表中的金额字段怎么获取那些是正数,那些是负数。
谢谢

------解决方案--------------------
SQL code

declare @T table (col money)
insert into @T
select 3.23 union all
select 4.54 union all
select -1.9 union all
select 9.8 union all
select -1.3

select * from @T where col>0
select * from @T where sign(col)=1
/*
col
---------------------
3.23
4.54
9.80
*/


select * from @T where col<0
select * from @T where sign(col)=-1
/*
col
---------------------
-1.90
-1.30
*/