有很多商品,m种,最后入库时间不一样,有什么方法能简单实现以下结果: m种产品各自最后的入库时间. 有很多商品,m种,最后入库时间不一样,有什么方法能简单实现以下结果: m种产品各自最后的入库时间. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select *from tb twhere not exists(select 1 from tb where 商品号=t.商品号 and 入库时间>t.入库时间) 如果不需要明细,可以这样select 商品号,max(入库时间) as 入库时间from tbgroup by 商品号 Select m ,Max(入库时间) From t Group By m select *from tb twhere 入库时间=(select max(入库时间) from tb where 商品号=t.商品号 ) 求一sql语句!!!!!!!!!!!!!!! 为什么RecordCount总是为-1? sql05生成脚本的问题 请问我安装的vs2005附带的sql2005express为什么不能使用用户名密码登录 关于在SQL SERVER中调用com组件 求教 金蝶自定义报表SQL语句实现,像第一个例子这样的过滤条件要怎么实现。, datetime列是否有必要建索引 求个自动编号的存储过程,谢谢 百分求数据库设计模式,关于小文件入库,答案满意得全部分。 请教存储过程问题 急求一个Sql语句 学生求解
from tb t
where not exists(select 1 from tb where 商品号=t.商品号 and 入库时间>t.入库时间)
select 商品号,max(入库时间) as 入库时间
from tb
group by 商品号
*
from
tb t
where
入库时间=(select max(入库时间) from tb where 商品号=t.商品号 )