按字段循环查询字段.. [英] looping through a query field by field..

查看:83
本文介绍了按字段循环查询字段..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,

我有一项任务,如下所示:首先我给了一些股票价格数据,我为它制作了一张桌子来存储数据,但是我想要caclulate这些股票价格的回报(每个股票价格在一个字段中,我的ID是日期)..想法是只使用一个嵌套的for循环,通过每个特定公司的每一行(字段)计算返回和移动到下一个公司并执行相同的任务..我知道在Excel中它只是一个命令,但我被分配在Access中执行它,我只是不知道VBA ..任何帮助将非常感谢..谢谢!

解决方案

我不知道但是一个合适的伪代码应该是这样的:

展开 | Sel ect | Wrap | 行号


还有别的东西应该是正确的但我又不知道怎么做:

首先,我与公司签了一张桌子,然后我传递了唯一的ID。然后我制作了股票价格表,所以这是一个时间序列,所以就像日期一样,字段就是公司。但我想说的是1,2,3 Etc字段的名称是表公司的ID。我正在寻找一个复合键的可能性,这个键将具有日期和公司ID。伙计们,我感谢你的帮助!!


公平警告,你的帖子很可能被删除,因为这个网站更多的是关于真实世界的例子,而不是为他们做一些人的作业。 />

但在此之前,如果我是你,我会花一些时间在查询编辑器中,试着很好地掌握它的含义。您正在仔细查看问题,并且您正在尝试编写程序程序来执行繁重的工作,同时基于Access Queries进行设置。这可能有所帮助, http://sqlmag.com/ T-SQL /编程-SQL基于集合的双向

Hey guys,
I have an assignment to do which is as follows: First I am given some stock price data, I made a table for it tha stores the data, but the I want to caclulate the returns of these stock prices(each stock price is in a field, and my ID is the date)..the idea is to use just a nested for loop that goes through each each row for a specific company(field) calculates the return and the moves to the next company and does the same task.. I know that in Excel it is just a command but I am assigned to do it in Access and I simply dont know VBA.. Any help would be strongly appreciated.. Thanks!

解决方案

i dont know but a proper pseudocode should be like that:

Expand|Select|Wrap|Line Numbers


Also something else which should be correct but again I dont know how:
First I made just a table with the companies and I passed the unique ID. Then I made the table of the stock prices so it is a time series so it is like date and the fields are the companies. But I would like to say that the name of the fields which is for me 1,2,3 Etc are the IDs from the table companies. I was looking if there is a possibility for a composite key this one that will have the date and the company ID. Guys I appreciate for the help!!


Fair warning, your post will most likely get removed as this site is more about real world examples than doing someone''s homework for them.

But before then, if I were you, I would spend some time in the Query Editor to try to get a good grasp on what it is about. You are looking too closely at the problem and you are trying to write procedural program to do the heavy lifting, while Access Queries are set based. This might help, http://sqlmag.com/t-sql/programming-sql-set-based-way


这篇关于按字段循环查询字段..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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