日期:2014-05-18 浏览次数:20498 次
create table A(ID int, SERIES decimal(6,1), ACTUALAMOUNT int) insert a select 1 ,1.0 ,2 union all select 1 ,1.5 ,5 union all select 2 ,1.3 ,3 union all select 2 ,2 ,4 create table B(ID int, QTY decimal(6,1)) insert b select 1 ,1 union all select 2 ,2.5 select a.*,显示=case when a.SERIES*b.QTY<=a.ACTUALAMOUNT then '正确' else '错误' end from a inner join b on a.id=b.id /* ID SERIES ACTUALAMOUNT 显示 ----------- --------------------------------------- ------------ ---- 1 1.0 2 正确 1 1.5 5 正确 2 1.3 3 错误 2 2.0 4 错误 (4 行受影响) */