所以,假设我有此表[Movements]:
Date Date of value description of movement Cost
12-01-2019 12-01-2019 BPI Taxes 1000€
12-01-2019 12-01-2019 Transference 2000€
12-02-2019 12-01-2019 Payments 2000€
第二张表[文档]:
Date Document Number Client Cost
01-03-2019 ADT19.30 X 1000€
01-03-2019 ADT20.30 y 2000€
01-03-2019 ADT20.30 z 2000€
第三表[参考]
Date Date of value description of movement Client Cost
12-01-2019 12-01-2019 BPI Taxes Doc. Number of X 1000€
12-01-2019 12-01-2019 Transference Doc. Number of Y 2000€
12-02-2019 12-01-2019 Payments Doc. Number of Z 2000€
结果表:
Date Date of value description of movement Client Cost
12-01-2019 12-01-2019 BPI Taxes ADT19.30 1000€
12-01-2019 12-01-2019 Transference ADT20.30 2000€
12-02-2019 12-01-2019 Payments ADT20.30 2000€
我的目标是,通过执行与“第三张表”的“客户”列中的““客户端”名称(第二张表)”相匹配的程序,并用“文档编号”值替换名称,以节省用户的时间。基本上,如果第二个表(客户列)的名称与第三个表的“客户”列匹配,然后在新表中插入新记录……我希望我弄清楚,这很难解释
更新 我到目前为止尝试过的查询:
Select Reference.[Date of movement], Reference.[Date of value], Reference.[Description], Document.[document Number], Reference.[Cost]
From Reference
INNER JOIN Document On Reference.[client] = Document.[document Number];
更新 原来,我理解错了,我应该这样做: 因此,假设我有此表[Movements]:
Date Date of value description of movement Cost
12-01-2019 12-01-2019 BPI Taxes of x 1000€
12-01-2019 12-01-2019 Transference of y 2000€
12-02-2019 12-01-2019 Payments of z 2000€
第二张表[文档]:
Date Document Number Client Cost
01-03-2019 ADT19.30 X 1000€
01-03-2019 ADT20.30 y 2000€
01-03-2019 ADT20.30 z 2000€
结果表:
Date Date of value description of movement Client Cost
12-01-2019 12-01-2019 BPI Taxes of x ADT19.30 1000€
12-01-2019 12-01-2019 Transference of y ADT20.30 2000€
12-02-2019 12-01-2019 Payments of z ADT20.30 2000€
我应该通过“运动描述”在字符串中查找是否在该字符串中包含名称,以及是否在数据库中包含插入 结果表