如何进行更新查询
我有一个包含五个字段的表,
|邮政编码 |数据1 |数据2 |数据3 |代码|
我的表及其下面的数据我有这样的记录音调,因此字段 [data 1]、[data2] 和 [data 3] 有许多重复的数据,
Zip | Data 1 | Data 2 | Data 3 | Code |
123 | __A__ |__ B__ |__ C__ |_____ |
234 | __A__ |__ B__ |__ C__ |_____ |
456 | __A__ |__ B__ |______ |_____ |
678 | __A__ |__ B__ |__ C__ |_____ |
981 | __A__ |__ B__ |______ |_____ |
我的目标是找到匹配的行值,因此我有一组唯一的来自它们的行(我通过给我的查询创建的)
| Data 1 | Data 2 | Data 3 | Code |
| __A__ |__ B__ |__ C__ |_____ |
| __A__ |__ B__ |______ |_____ |
我想要做的就是在该查询中输入一个代码值,以便它反映在现有表上并显示所有重复值中的代码,
所以说我输入查询中的数据(我无法输入由于某种原因)
| Data 1 | Data 2 | Data 3 | Code |
| __A__ |__ B__ |__ C__ |__C1__ |
| __A__ |__ B__ |______ |__C2__ |
我想要表中的以下输出
Zip | Data 1 | Data 2 | Data 3 | Code |
123 | __A__ |__ B__ |__ C__ |__C1__ |
234 | __A__ |__ B__ |__ C__ |__C1__ |
456 | __A__ |__ B__ |______ |__C2__ |
678 | __A__ |__ B__ |__ C__ |__C1__ |
981 | __A__ |__ B__ |______ |__C2__ |
我该怎么做?
I have a table with five fields,
| Zip code | Data 1 | Data 2 | Data 3 | Code |
my table and its data below i have tones of records like this so there are many duplicate data for fields [data 1], [data2] and [data 3]
Zip | Data 1 | Data 2 | Data 3 | Code |
123 | __A__ |__ B__ |__ C__ |_____ |
234 | __A__ |__ B__ |__ C__ |_____ |
456 | __A__ |__ B__ |______ |_____ |
678 | __A__ |__ B__ |__ C__ |_____ |
981 | __A__ |__ B__ |______ |_____ |
my goal is to find the matching row values so i have a set of unique row from them (which i created by a query this gave me )
| Data 1 | Data 2 | Data 3 | Code |
| __A__ |__ B__ |__ C__ |_____ |
| __A__ |__ B__ |______ |_____ |
What i wanted to do with this was just enter a code value in that query so it reflects on the existing table and displays the code in all duplicate values ,
so say i enter this data in the query,( which i cannot enter for some reason )
| Data 1 | Data 2 | Data 3 | Code |
| __A__ |__ B__ |__ C__ |__C1__ |
| __A__ |__ B__ |______ |__C2__ |
i want the following output in the table
Zip | Data 1 | Data 2 | Data 3 | Code |
123 | __A__ |__ B__ |__ C__ |__C1__ |
234 | __A__ |__ B__ |__ C__ |__C1__ |
456 | __A__ |__ B__ |______ |__C2__ |
678 | __A__ |__ B__ |__ C__ |__C1__ |
981 | __A__ |__ B__ |______ |__C2__ |
How can i do this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,选择不同的值并将它们插入到临时表或临时表中:
接下来,将不同的行插入到表中
接下来,使用每条记录所需的任何代码更新临时表。仍然不确定您是否有一个特定的值,或者您是否希望它只是一个“唯一”值。如果是唯一值,您可以将代码设置为身份并跳过此步骤
最后,使用值更新原始表
First, select your distinct values and insert them into a temporary table or scratch table:
Next, insert distinct rows into your table
Next, update your temp table with whatever code you want for each record. Still not sure if you have a specific value in mind or if you want it to be just a "unique" value. If a unique value, you could set code to be an identity and skip this step
Lastly, update your original table with the values