如何在 MS Access 2010 中组合多种查询类型?
我有一个在 VBA 中创建的查询,它从其他两个表中选择列信息,并使用该信息创建一个新表。
现有查询:
选择Prem.经度、Prem.纬度、 DataByColl.[MIU ID]、DataByColl.[平均 RSSI],Prem.prem_addr1
进入 [FifthAveMeshInput]
来自[Prem]
左边 加入DataByColl
ON(Prem.meter_miu_id = DataByColl.[MIU ID] AND DataByColl.Collector = ("第五大道。"))
按 DataByColl 排序。[平均 RSSI] desc
我想添加到这两个字段。一种称为“索引”,从值 2 开始自动递增,另一种称为“MeterType”,它是所有值都设置为 0 的数字。是否可以在一个查询中包含所有这些内容,或者我必须使用单独的查询来完成这个?如果我需要使用单独的查询,我需要哪些查询以及按什么顺序?
I have a query that is created in VBA and selects column information from two other tables and creates a new table with that information.
Existing Query:
Select Prem.longitude, Prem.latitude,
DataByColl.[MIU ID], DataByColl.[Avg
RSSI], Prem.prem_addr1
Into [FifthAveMeshInput]
From [Prem]
Left
Join DataByColl
ON (Prem.meter_miu_id
= DataByColl.[MIU ID] AND DataByColl.Collector = ("Fifth Ave."))
ORDER BY DataByColl.[Avg RSSI] desc
I would like to add to this two fields. One called Index that is auto incremented starting at a value of 2 as well as one called MeterType that is a number with all values set to 0. Is it possible to have all of these in one query or would I have to use separate queries to accomplish this? And if I would need to use separate queries which ones would I need and in what order?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
必须是两个步骤:
DDL
CREATE TABLE...
语法这)。
进入..选择。
上述的一个问题是,您必须首先发现查询中列的数据类型,并在表创建步骤中使用它们。
或者:
选择..进入..FROM
。列。
上述的一个问题是,您需要自己填充自动增量值(如果我的想法是正确的,则不能将自动增量属性添加到现有列),这实际上可能会破坏具有首先是一个自动增量列!
Has to be two steps:
DDL
CREATE TABLE...
syntax forthis).
INSERT
.INTO..SELECT
One issue with the above is that you have to first discover the data types of the columns in your query and use them in the table creation step.
Alternatively:
SELECT..INTO..FROM
.columns.
One issue with the above is that you'd need to populate the auto-increment values yourself (if I am correct in thinking one can't add the auto-increment property to an existing column), which may actually defeat the object of having an auto-increment column in the first place!