日期:2014-05-17 浏览次数:20671 次
select MAX(id) 'id' ,max(num) 'num' from tt
group by snum
having max(num)>=2
select MAX(id) 'id' ,max(num) 'num' from tt
group by snum
having num>=2
----------------------------------------------------------------
-- Author :DBA_Huangzj(發糞塗牆)
-- Date :2013-11-26 11:44:17
-- Version:
-- Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64)
-- Dec 28 2012 20:23:12
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: )