需要查询以运行X次以获取日期范围 [英] Need a Query to Run X times for a date range
本文介绍了需要查询以运行X次以获取日期范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我是新来的,也可以访问,
我现在遇到的问题是我在输入时提出了一个查询一个约会,它将搜索我最后一次购买以及成本。
Hi Everyone, I''m new here and to access as well,
The problem I''m having right now is that I made a Query that upon the input of a date, it will search for the last purchase I made and at what cost.
展开 | 选择 | Wrap | 行号
推荐答案
如果你希望它运行三次然后是的,我可以看到一些编码涉及。
我可以建议删除Totals并使用基本的sql select语句:
If you want it to run three times then yes I could see some coding involded.
May I suggest dropping the Totals and use a basic sql select statement:
展开 | / span> 选择 | 换行 | 行号
如何通过[ProductID]和[PurchaseDate]对结果进行分组?
问候,
鱼。
What about grouping results by [ProductID] and [PurchaseDate]?
Regards,
Fish.
>
好的,谢谢你的提示。使用该查询,我能够列出我为一系列日期所做的所有购买。
我现在遇到的问题是当我把另一个查询放在一起来匹配我的时候销售价格和购买价格,它列出了每一个组合。
For Ex)
购买于5/1 5/3 5/7
5/6销售订单#1
5/8销售订单#2
我的查询结果每个给我3个条目对于销售订单#1和#2,执行所有组合。
但是,我想要的结果是将销售订单与销售日期之前的最后一个购买日期相匹配:
5/3购买销售订单#1
5/7购买销售订单#2
基本上,我想要的是LIFO会计方法。
再次感谢。
OK thanks for the tips. Using that query, I''m able to list all the purchases I made for a range of dates.
The problem I face now is when i put together another query to match up my sales price and purchase price, it lists out every single combination.
For Ex)
Purchases made on 5/1 5/3 5/7
Sales order #1 on 5/6
Sales order #2 on 5/8
my query results give me 3 entries each for sales order #1 and #2, doing all the combinations.
The result I want, however, is to match up the sales order with ONLY the last purchase date before my sales date:
Sales order #1 with 5/3 purchase
Sales order #2 with 5/7 purchase
Essentially, what i want is the LIFO accounting method.
Thanks again.
这篇关于需要查询以运行X次以获取日期范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文