avatar
How to write this query# Database - 数据库
b*o
1
Suppose I have a table taking care of incoming:
Date amount unit_price($)
01/01/05 5 7
01/02/05 4 2
01/03/05 6 3
01/04/05 3 6
01/05/05 8 1
Also have a table taking care of outgoing:
Date amount cost($)
01/01/05 2
01/02/05 7
01/03/05 6
01/04/05 3
01/05/05 4
I would like to define the outgoing cost using "First in First out", so the
cost should be calculated as:
Date amount cost($)
01/01/05 2 2*$7
avatar
s*n
2
simple query can't do this bah? at least u need a sproc with cursor...

【在 b*****o 的大作中提到】
: Suppose I have a table taking care of incoming:
: Date amount unit_price($)
: 01/01/05 5 7
: 01/02/05 4 2
: 01/03/05 6 3
: 01/04/05 3 6
: 01/05/05 8 1
: Also have a table taking care of outgoing:
: Date amount cost($)
: 01/01/05 2

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。