增量查询分配随机数 [英] Increment query is assigning random numbers
问题描述
大家好,
我一直在努力改进已建立的MS访问数据库。导入表中有一个优先级字段,当您重新导入与表中已存在的条目匹配的数据时,它会被重置,为新数据赋予优先级1。
这使用更新查询,其中新优先级设置为现有优先级的+1(参见附图)。但是,这是指定大于现有优先级的随机数,而不是将所有现有优先级递增1。
我导入了一个数据字段4次,结果是:
优先级
1
8
78
85
我希望优先级为1,2, 3,4 ????如何让它们增加1,而不是随机分配整数?
我很困惑,任何帮助都会很棒。
在此先感谢,
Dmac
Hello all,
I''ve been working on refining an established MS access database. There is a priority field in an import table, and it gets reset when you re-import data that matches entries already existing in the table, giving a priority 1 to the new data.
This uses an update query, with where the new priority is set at +1 from the existing priority (see attached picture). However, this is assigning random numbers greater than the existing priority, instead of incrementing all existing priorities by one.
I imported the one data field 4 times, this was the result:
priority
1
8
78
85
I expecting the priorities to be 1,2,3,4???? How do I get them to increment by 1, instead of randomly assigning integers?
I am confused, any help would be awesome.
Thanks in advance,
Dmac
推荐答案
请向我们展示同一查询的SQL视图。
Show us the SQL view of that same query, please.
您好RuralGuy,
感谢您的快速回复。这是SQL:
Hi RuralGuy,
Thanks for your quick response. Here is the SQL:
尝试将最后一行设置为:
Try setting the last line to:
这篇关于增量查询分配随机数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!