进货单的数据表中,一个货品有很多进货日期,不同的进货价格,我取最近一次的进货价该如何写sql语句?试过:
select * from table A
where not exists
select 1 from table where goodsname=A.goodsname and credate>A.credate但还是有数量重复数据,而且是查的整个库存,需要很长时间!且不能指定查询条件!用分组函数还是不行,盼赐教!谢谢!
select * from table A
where not exists
select 1 from table where goodsname=A.goodsname and credate>A.credate但还是有数量重复数据,而且是查的整个库存,需要很长时间!且不能指定查询条件!用分组函数还是不行,盼赐教!谢谢!
解决方案 »
- Oracle 11.2.0.1.0 expdp 报错
- 求助,有关Oracle表更新问题!!!欢迎高手解答
- 启动oracle报:ORA-01589错误,三个日志文件介质恢复操作都失败,求救啊!
- oracle启动报错,ora-00204:??????
- 划分vlan后,oracle不通了
- 简单问题
- oracle 字符集问题
- 带有“喆”字的信息存不到数据库里(问了好多OCP讲师都回答不了)
- 請教一下各位大俠怎樣編譯Pro*C和源文件.pc,?
- 各位大神 有什么好办法可以做两个相同数据库的部分数据的导入导出?
- 数据库连接不稳定,出错Fatal NI connect error 12203
- pl/sql 报01722 无效的数字,怎么解决?
from (select goodname,price, dense_rank() over (partition by credate order by credate desc) rank_no from tableA)
where rank_no = 1 order by goodname,price
这个是可以的
select goodname,credate,price
from (select goodname,credate,price, dense_rank() over (partition by goodname order by credate desc) rank_no from A)
where rank_no = 1 order by goodname,price;