select * from Buy t1,(select Item_ID ,max(Buy_Time) as Buy_Time from Buy group by Item_ID ) t2
where t1.item_id=t2.item_id and t1.buy_time=t2.buy_time
where t1.item_id=t2.item_id and t1.buy_time=t2.buy_time
解决方案 »
- TADOStoredProc.ProcedureName="sp_AutoMoney;1" 其中 ";1" 是什么意思?
- PD 建立数据库出错
- 求一条SQL语句
- 老鸟们帮忙看下这个是什么错误 急急 等中
- 触发器问题
- 请问主键的长度对于建立在主键列上的索引所占存储空间有没有影响?
- sqlserver2000在登陆查询分析器的时候以“。”可以登陆,而以127.0.0.1 或 localhost无法登陆(在线等)
- 定义主键后自动建立簇索引,那么是不是对这个主键就不用建立非簇索引了?
- 90万条数据在进行以下查询进出现超时错误
- 斑竹:关于记录的插入,更新操作问题,help me!
- 急急急急急!高手帮忙啊!
- 安装ms sql2000中遇到的一个问题
from Buy a
where Buy_Time = (select max(Buy_Time) from buy where Item_ID = a.Item_ID)
select *
from Buy a
where not exists (select 1 from buy where Item_ID = a.Item_ID and Buy_Time > a.Buy_Time)