Table 1 - Deal ID, REF NOS, Type, Papa ID
Table 2 - Deal ID, Type
在一个名为 Method used 的新视图中创建一个列。设置字段的方式如下(4个条件);
If Deal ID from table 1 Exists in Table 2 and Type is not Null from Table 2.
Set Method used to be Y
If Deal ID does not exist in Table 1 and Type does not contain 27,42 or 55 in Table 1.
Set Method used to be Y
If Papa ID is null from Table 1, and Type does not contain 27,42 or 55 in Table 1.
Set Method used to be Y
Else
Set to N
开始它并想哇!
create view Master as (
select Deal ID, REF NOS, Type, Papa ID
[Method used]=
Case
When
from Table 1 A
)