我想比较一组列并决定:
示例输入和输出:
<input date-range-picker="" readonly="" class="form-control input-date-fields-readonly ng-pristine ng-valid ng-isolate-scope ng-empty ng-touched" type="text" ng-model="model[options.key]" options="daterangepicker.options" id="formly_1_daterangepicker_caseCreationRange_4" name="formly_1_daterangepicker_caseCreationRange_4" formly-custom-validation="" tabindex="9" aria-describedby="formly_1_daterangepicker_caseCreationRange_4_description" style="">
我需要测试的列数很多,因此比较每一个的逻辑语句有点麻烦。
系统:Teradata SQL数据库
答案 0 :(得分:1)
您将使用case
表达式。也许:
select (case when a is null and b is null and c is null and d is null
then 'all null'
when coalesce(a, b, c, d) = coalesce(b, c, d, a) and
coalesce(a, b, c, d) = coalesce(c, d, b, a) and
coalesce(a, b, c, d) = coalesce(d, a, b, c)
then 'all non-nulls are equal'
else 'unequal'
end);