读书人

求好手给条sql 啊

发布时间: 2012-07-31 12:33:47 作者: rapoo

求高手给条sql 啊!!!!!!


有以上数据,要求返回 根据coupon_xuhao字段 最新的一条记录

即:





[解决办法]

探讨

SQL code
select * from xxx x1 where coupon_date = (select max(coupon_date) from xxx x2 where x1.coupon_id = x2.coupon_id group by coupon_xuhao );

[解决办法]
where x1.coupon_xuhao = x2.coupon_xuhao group by coupon_xuhao
明显这个group by 是没用的。

读书人网 >Java Web开发

热点推荐