根据前 5 列值填充第 6 列
Populating 6th column based on the previous 5 column values
请帮助我根据 SSIS 中 5 列的值填充 Marketingsegmentscore ActiveStatus InactiveStatus LapsedStatus NoSpecialEventsStatus SpecialEventsStatus
if active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 1.
if active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 0 and nospec_flag = 1 marketing_grid_score = 2.
if active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 1 and nospec_flag = 1 marketing_grid_score = 3.
if active= 0 and inactive = 1 and lapsed = 0 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 4.
if active= 0 and inactive = 1 and lapsed = 0 and spec_flag = 0 and nospec_flag = 1 marketing_grid_score = 5.
if active= 0 and inactive = 1 and lapsed = 0 and spec_flag = 1 and nospec_flag = 1 marketing_grid_score = 6.
if active= 0 and inactive = 0 and lapsed = 1 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 7.
if active= 0 and inactive = 0 and lapsed = 1 and spec_flag = 0 and nospec_flag = 1 marketing_grid_score = 8.
if active= 0 and inactive = 0 and lapsed = 1 and spec_flag = 1 and nospec_flag = 1 marketing_grid_score = 9.
╔═══════════════╦══════════════╦════════════════╦══════════════╦═══════════════════════╦═════════════════════╦═══════════════════════╗
║ AccountNumber ║ ActiveStatus ║ InactiveStatus ║ LapsedStatus ║ NoSpecialEventsStatus ║ SpecialEventsStatus ║ MarketingSegmentScore ║
╠═══════════════╬══════════════╬════════════════╬══════════════╬═══════════════════════╬═════════════════════╬═══════════════════════╣
║ 12345 ║ 1 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║
║ 45678 ║ 0 ║ 1 ║ 0 ║ 1 ║ 1 ║ 0 ║
║ 79011 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║ 0 ║
║ 112344 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║ 0 ║
║ 145677 ║ 1 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║
║ 179010 ║ 0 ║ 0 ║ 1 ║ 1 ║ 1 ║ 0 ║
╚═══════════════╩══════════════╩════════════════╩══════════════╩═══════════════════════╩═════════════════════╩═══════════════════════╝
- 列表项
212343 0 0 1 1 1 0
您是否尝试过使用 CASE ... END。基本上你只想做类似
的事情
UPDATE table SET MarketingSegmentScore =
CASE WHEN active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 1 THEN whatever value you want
CASE WHEN next condition
etc...
END
您将需要派生列任务,并在派生列中使用以下表达式设置 MarketingSegmentScore
列的值。
active== 1 && inactive == 0 && lapsed == 0 && spec_flag == 1 && nospec_flag == 0 ? 1 :(
active== 1 && inactive == 0 && lapsed == 0 && spec_flag == 0 && nospec_flag == 1 ? 2 :(
active== 1 && inactive == 0 && lapsed == 0 && spec_flag == 1 && nospec_flag == 1 ? 3 :(
active== 0 && inactive == 1 && lapsed == 0 && spec_flag == 1 && nospec_flag == 0 ? 4 :(
active== 0 && inactive == 1 && lapsed == 0 && spec_flag == 0 && nospec_flag == 1 ? 5 :(
active== 0 && inactive == 1 && lapsed == 0 && spec_flag == 1 && nospec_flag == 1 ? 6 :(
active== 0 && inactive == 0 && lapsed == 1 && spec_flag == 1 && nospec_flag == 0 ? 7 :(
active== 0 && inactive == 0 && lapsed == 1 && spec_flag == 0 && nospec_flag == 1 ? 8 :(
active== 0 && inactive == 0 && lapsed == 1 && spec_flag == 1 && nospec_flag == 1 ? 9 :0))))))))
请帮助我根据 SSIS 中 5 列的值填充 Marketingsegmentscore ActiveStatus InactiveStatus LapsedStatus NoSpecialEventsStatus SpecialEventsStatus
if active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 1.
if active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 0 and nospec_flag = 1 marketing_grid_score = 2.
if active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 1 and nospec_flag = 1 marketing_grid_score = 3.
if active= 0 and inactive = 1 and lapsed = 0 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 4.
if active= 0 and inactive = 1 and lapsed = 0 and spec_flag = 0 and nospec_flag = 1 marketing_grid_score = 5.
if active= 0 and inactive = 1 and lapsed = 0 and spec_flag = 1 and nospec_flag = 1 marketing_grid_score = 6.
if active= 0 and inactive = 0 and lapsed = 1 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 7.
if active= 0 and inactive = 0 and lapsed = 1 and spec_flag = 0 and nospec_flag = 1 marketing_grid_score = 8.
if active= 0 and inactive = 0 and lapsed = 1 and spec_flag = 1 and nospec_flag = 1 marketing_grid_score = 9.
╔═══════════════╦══════════════╦════════════════╦══════════════╦═══════════════════════╦═════════════════════╦═══════════════════════╗
║ AccountNumber ║ ActiveStatus ║ InactiveStatus ║ LapsedStatus ║ NoSpecialEventsStatus ║ SpecialEventsStatus ║ MarketingSegmentScore ║
╠═══════════════╬══════════════╬════════════════╬══════════════╬═══════════════════════╬═════════════════════╬═══════════════════════╣
║ 12345 ║ 1 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║
║ 45678 ║ 0 ║ 1 ║ 0 ║ 1 ║ 1 ║ 0 ║
║ 79011 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║ 0 ║
║ 112344 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║ 0 ║
║ 145677 ║ 1 ║ 0 ║ 0 ║ 1 ║ 1 ║ 0 ║
║ 179010 ║ 0 ║ 0 ║ 1 ║ 1 ║ 1 ║ 0 ║
╚═══════════════╩══════════════╩════════════════╩══════════════╩═══════════════════════╩═════════════════════╩═══════════════════════╝
- 列表项
212343 0 0 1 1 1 0
您是否尝试过使用 CASE ... END。基本上你只想做类似
的事情UPDATE table SET MarketingSegmentScore =
CASE WHEN active= 1 and inactive = 0 and lapsed = 0 and spec_flag = 1 and nospec_flag = 0 marketing_grid_score = 1 THEN whatever value you want
CASE WHEN next condition
etc...
END
您将需要派生列任务,并在派生列中使用以下表达式设置 MarketingSegmentScore
列的值。
active== 1 && inactive == 0 && lapsed == 0 && spec_flag == 1 && nospec_flag == 0 ? 1 :(
active== 1 && inactive == 0 && lapsed == 0 && spec_flag == 0 && nospec_flag == 1 ? 2 :(
active== 1 && inactive == 0 && lapsed == 0 && spec_flag == 1 && nospec_flag == 1 ? 3 :(
active== 0 && inactive == 1 && lapsed == 0 && spec_flag == 1 && nospec_flag == 0 ? 4 :(
active== 0 && inactive == 1 && lapsed == 0 && spec_flag == 0 && nospec_flag == 1 ? 5 :(
active== 0 && inactive == 1 && lapsed == 0 && spec_flag == 1 && nospec_flag == 1 ? 6 :(
active== 0 && inactive == 0 && lapsed == 1 && spec_flag == 1 && nospec_flag == 0 ? 7 :(
active== 0 && inactive == 0 && lapsed == 1 && spec_flag == 0 && nospec_flag == 1 ? 8 :(
active== 0 && inactive == 0 && lapsed == 1 && spec_flag == 1 && nospec_flag == 1 ? 9 :0))))))))