在数据验证中使用 case 语句
Using a case statement in data validation
我有两个表,t1 和 t2,用 ID 字段连接
我需要测试一下-
1. t1.ROE is 1 when t2.Currency1 = t2.Currency2
2. t1.ROE is equal to t2.ROE, otherwise
请帮我生成一个脚本。
尝试像这样使用 or
运算符:
select *
from t1
join t2 on t1.id = t2.id
and ((t1.ROE = 1 and t2.Currency1 = t2.Currency2) or(t1.ROE <> 1 and t1.ROE = t2.ROE))
我有两个表,t1 和 t2,用 ID 字段连接 我需要测试一下-
1. t1.ROE is 1 when t2.Currency1 = t2.Currency2
2. t1.ROE is equal to t2.ROE, otherwise
请帮我生成一个脚本。
尝试像这样使用 or
运算符:
select *
from t1
join t2 on t1.id = t2.id
and ((t1.ROE = 1 and t2.Currency1 = t2.Currency2) or(t1.ROE <> 1 and t1.ROE = t2.ROE))