日期:2014-05-17 浏览次数:20454 次
SELECT T1.*,T2.A2 AS A3 FROM qqqqqqqqqqqqqq T1
LEFT JOIN (SELECT MIN(A1) AS A1,A2 FROM qqqqqqqqqqqqqq T1
GROUP BY A2)T2 ON T2.A1=T1.A1
SELECT T1.*,T2.A2 AS A3 FROM qqqqqqqqqqqqqq T1
LEFT JOIN (SELECT A1,A2 FROM
(SELECT *,ROW_NUMBER() OVER (PARTITION BY A2 ORDER BY A1) AS 'RowNumber'
FROM qqqqqqqqqqqqqq)RR
WHERE RR.ROWNUMBER=1)T2 ON T2.A1=T1.A1