自动查询以使用输入值(数组) [英] Automating Query to use input values (array)

查看:70
本文介绍了自动查询以使用输入值(数组)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试自动运行SQL查询。我在Access 2003中有一个表,其中包含多个字段的记录(成员标识符,$ amount和一年中他们是成员的月份)。我想创建一个直方图。根据$金额所属的桶来计算和汇总信息。例如,所有成员的金额介于0和$ 1之间,所有成员介于1美元和100美元之间等等。我写的两个查询按步骤执行此操作,并且当前提示我输入最小值和最大值。第一个查询是一个Select Query,它创建一个包含Min和Max之间所有记录的表。第二个查询然后折叠数据以汇总$ amount并计算成员数。然后我将结果复制到Excel电子表格中。


如何自动执行此过程,以便我可以使用Min和Max对数组作为输入自动运行查询?我也希望每次运行的输出自动(并连续)存储在Excel工作表中。


以下是我编写的SQL查询:

第一个被称为CLT并创建一个由第二个使用的表

展开 | 选择 | Wrap | 行号

解决方案

金额他们是一年中的几个月。我想创建一个直方图。根据


金额所属的桶来计算和汇总信息。例如,所有


的成员数量介于0和

Hi,

I am trying to automate the running of a SQL Query. I have a Table in Access 2003 that contains records with several fields, (member identifier, $ amount and months during the year they were members). I want to create a "histogram" of sorts to count and sum the information depending on which bucket the $ amount falls in. For example all members with $ amount between 0 and $1, all members between $1 and $100, etc. The two Queries I have written do this in steps, and currently prompts me to enter the Min and Max values. The first query is a Select Query that creates a Table of all records that fall betwqeen the Min and Max. The second Query then collapses the data to Sum the $ amount and count the members. I then copy the result into an Excel spreadsheet.

How can I automate this process so that I can have the Queries run automatically using as an input an array of Min and Max pairs? I''d also like the output of each run to be automatically (and successively) stored in an Excel Worksheet.

Here are the SQL Queries I have written:
The first is called CLT and creates a Table used by the second

Expand|Select|Wrap|Line Numbers

解决方案

amount and months during the year they were members). I want to create a "histogram" of sorts to count and sum the information depending on which bucket the


amount falls in. For example all members with


amount between 0 and


这篇关于自动查询以使用输入值(数组)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆