问题描述
我有四个表FDQueries(Firebird 3.0)国家,地区,部门和城市,还有第五个temporay FDQuery,其中显示CITIES表以及来自其他表的相关数据,如下所示:
I have four tables FDQueries (Firebird 3.0) COUNTRIES, REGIONS, DEPARTMENTS, AND CITIES and a fifth temporay FDQuery where to display CITIES table with related data from others tables as following :
SELECT C.NAMEXXX AS NAMEXXX, D.NAMEXXX as NAMEXXX, R.NAMEXXX AS NAMEXXX, T.NAMEXXX AS NAMEXXX
FROM GEOCITI C
LEFT JOIN GEODEPT D ON D.PKINDEX = C.FKDEPAR
LEFT JOIN GEOREGI R ON R.PKINDEX=D.FKREGIO
LEFT JOIN GEOCOUN T ON T.PKINDEX=R.FKCOUNT
该连接工作正常,并显示了我想要的内容:
The join is working perfectly and showing what i want :
现在完成了,我希望用户直接从显示联接表(临时)的网格中编辑CITIES表.我的问题是如何使用仅发布原始CITIES Table的简单帖子进行正确的更新方式
Now this done, i want the user to edit the CITIES table directly from the Grid showing the joined table (Temporary) My question is how to do this the right way to update with a simple post only original CITIES Table
非常抱歉,我第一个提出问题
Thanks and sorry for my first question formulation
推荐答案
您可以使用以下查询通过join更新表-
You can use following query to update table using join -
UPDATE CITIES
SET CITYPOPULATION = YOUR_UPDATED_VALUE
FROM CITIES C
JOIN DEPARTMENTS D ON C.departmentname = D.NAME
JOIN COUNTRIES CT ON D.countryname = CT.name;
You can read this article for further update.
这篇关于编辑和更新联接的查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!