select * from 表 a,(select VID,max(InputDay) InputDay from 表 group by VID) b where a.VID=b.VID and a.InputDay=b.InputDay
解决方案 »
- SQL 2008怎么把table的结构和索引语法调出来?
- sql小问题
- 请问BOM表和相关表怎么设计?(需要考虑采购在途,库存占用),MRP运算怎么写?请各位回答,不愿免费回答的,可以现金,加我QQ:47143107
- 求一SQL语句,单表。有数据。
- 求一日期函数。头晕了。
- sql重复记录查找问题,请高手进(在线等..解决就结贴)
- 问一个问题!!!欢迎回答!
- 大家帮帮我吧
- 现在的sql server2000的数据库中有数据(要重新安装服务器了),请问数据如何转化到另外一台SQL server2000的机器上面去啊?
- sybase问题:请教大侠。
- sql存储过程多条件like查询时出错!
- 2005企業管理器,可以用來管理2000嗎?
where exists(select top 1 * from A A2
where A1.VID<>A2.VID and A1.InputDay>A2.InputDay)
a.*
from
表 a
where
not exists(select 1 from 表 where vid=a.vid and inputday>a.inputday)
where exists(select 1 from A A2
where A1.VID<>A2.VID and A1.InputDay>A2.InputDay)
where not exists (select 1
from tablename as b where a.inputday>b.inoutday and a.vid = b.vid)
from yourtable t
where not exists(select 1 from yourtable where vid=t.vid and inputday>t.inputday)
where a.Price=b.price and a.vid=b.vid