取多张进货单的最近一次时间的进货价格,用如下语句可以查询整个库存,但速度慢:
select * from BMS_SU_DTLQRY_V A
where not exists
(select 1 from BMS_SU_DTLQRY_V where goodsname=A.goodsname and credate>A.credate)在实现单品查询最近进货价的时候插入语句却出错!还需要根据品名模糊查询!请指教下SQL语句?
select * from BMS_SU_DTLQRY_V A
where not exists
(select 1 from BMS_SU_DTLQRY_V where goodsname=A.goodsname and credate>A.credate)在实现单品查询最近进货价的时候插入语句却出错!还需要根据品名模糊查询!请指教下SQL语句?
解决方案 »
- 线程 Sleep很短时间 问题???
- rxrichedit中,如何遍历图片
- 在主窗体实现子窗体:在主窗体的panel上展开,并可自由拖动???
- 呼叫中心寻求兼职人员
- 怎摸用ADO直接打开一个文本文件的记录集(文本文件存储的是一个记录集)
- 我窗体老被覆盖在它上面窗体搞花怎么办啊?
- 把标准C语言转成pascal语的工具
- 请教:非常奇怪的,socket 发送字符串可以,但是发送图片就不行,这是什么原因啊?谢谢!
- ClientDataSet.ApplyUpdates 报出错误:列名“XX”无效
- 解决了全部分数送上,谢,idhttp上传的文件名最多是41个字符,请问这是怎么回事?
- 简单问题(case用法)
- 怎样显示DIB
按如下方法试试[code=SQL]
create table t
(id number,
a date,
b number);insert into t
(select 1,to_date('2007-01-01','yyyy-mm-dd'),20.00 from dual)
union all
(select 1,to_date('2008-01-01','yyyy-mm-dd'),80.00 from dual)
union all
(select 1,to_date('2009-01-01','yyyy-mm-dd'),90.00 from dual)
union all
(select 2,to_date('2007-02-01','yyyy-mm-dd'),20.00 from dual)
union all
(select 2,to_date('2008-02-01','yyyy-mm-dd'),80.00 from dual)
union all
(select 2,to_date('2009-02-01','yyyy-mm-dd'),90.00 from dual);
select id,a,b
from
(select id,a,b,
row_number()over(partition by id order by id,b desc)r
from t
)
where r=1;
[/code]