0
我想指望所有记录的最新记录同一类别的纪录属于一个类别&得到了最新的纪录续其他同伙与类别
CREATE TABLE #TestTable
(
SomeColumn VARCHAR(1)
,data varchar(50)
,CDate datetime
)
GO
INSERT INTO #TestTable VALUES ('A','abdss',getdate())
INSERT INTO #TestTable VALUES ('A','abserts',getdate())
INSERT INTO #TestTable VALUES ('A','awabs',getdate())
INSERT INTO #TestTable VALUES ('A','abrfgts',getdate())
INSERT INTO #TestTable VALUES ('A','abasds',getdate())
INSERT INTO #TestTable VALUES ('A','abasds',getdate())
INSERT INTO #TestTable VALUES ('A','aberzsdsfs',getdate())
INSERT INTO #TestTable VALUES ('A','abarfzdfs',getdate())
INSERT INTO #TestTable VALUES ('B','abzdsfs',getdate())
--SELECT * , COUNT(SomeColumn) From #TestTable
--GROUP BY SomeColumn
drop table #TestTable
相关的数据所需的输出将是
SomeColumn | Data | Date |Other Associates Records <br/>
A | abarfzdfs |last A record date |7<br/>
B | abzdsfs |last B record date |0<br/>
@UmbrellaCorporation:记得投票答案,你认为是好的。这给了我们一种温暖的模糊感觉:P – Arion