选择并比较最后两个成本条目 [英] SELECT and compare last two cost entries

查看:43
本文介绍了选择并比较最后两个成本条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要监控产品成本价格的变化。

每件产品的历史成本都存储在一个表''trade''

所以通过比较每个产品的最新两个条目,基于字段''last_updated''我可以衡量成本价格的变化。

但我正在努力解决这个问题。

我我想我需要使用别名来加入同一个表所以

展开 | 选择 | Wrap | 行号

解决方案

这会有效吗? br />

展开 | 选择 | Wrap | 行号


感谢您的回复。

我担心这是无效的语法。

还有另外一个使用你的想法

展开 | 选择 | Wrap | 行号


你能发布一些样本数据吗?


- CK

I need to monitor the change in the cost price of products.
The historic cost of every product is stored in a table ''trade''
So by comparing the latest two entries per product based on the field ''last_updated'' I can measure the change in cost price.
But I am struggling with the query.
I think I need to JOIN the same table using aliases so-

Expand|Select|Wrap|Line Numbers

解决方案

will this work?

Expand|Select|Wrap|Line Numbers


Thanks for your reply.
I am afraid this is invalid syntax.
Had another go using your idea

Expand|Select|Wrap|Line Numbers


Could you post some sample data?

-- CK


这篇关于选择并比较最后两个成本条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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