SQL代码建议 [英] SQL Code Suggestion

查看:60
本文介绍了SQL代码建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个名称为  Mapping_Missing_State_Code_FPA并使用以下等式运行的映射表

I created a mapping table with name Mapping_Missing_State_Code_FPA and using the below equation to run

更新A

UPDATE A

SET

A. [州代码] = B. [州代码_N],

A.[State Code] = B.[State Code_N],

A. [映射原因] ='缺少SC'

A.[Mapping reason] = 'Missing SC'

FROM Sales_All_w_WH_v2 A,Mapping_Missing_State_Code_FPA   B

FROM Sales_All_w_WH_v2 A, Mapping_Missing_State_Code_FPA  B

WHERE

A. [经销商] = B. [经销商]和

A.[Distributor] = B.[Distributor] and

A. [CustID] = B. [CustID]和

A.[CustID] = B.[CustID] and

IS NULL(A. [州代码])

IS NULL (A.[State Code] )

此代码有问题。

重点是分销商和客户A中的Id与B中的ID匹配,然后将状态代码的值从B替换为A,前提是A中的状态代码为空。

The point is where Distributor and Cust Id in A matched with be those in B then replace values of State code from B into A, provided State code in A is null.




推荐答案

您好,

请更改  IS NULL(A. [国家代码]) A. [国家代码]  IS NULL

Please change IS NULL(A.[State Code]) by A.[State Code] IS NULL

希望有所帮助:)


这篇关于SQL代码建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆