日期:2014-05-17 浏览次数:20651 次
SELECT ListClothID,
       ListClothImageSmall
FROM   (SELECT Row_number()
                 OVER(
                   ORDER BY a.ListClothID )rn,
               a.ListClothID,
               b.ListClothImageSmall
        FROM   (SELECT DISTINCT ListClothID
                FROM   ListClothImage) AS a
               LEFT JOIN ListClothImage b
                      ON a.ListClothID = b.ListClothID)b
WHERE  rn = 1
------解决方案--------------------
SELECT ListClothID,
       ListClothImageSmall
FROM   (SELECT Row_number()
                 OVER(
                   ORDER BY a.ListClothID )rn,
               a.ListClothID,
               b.ListClothImageSmall
        FROM   (SELECT DISTINCT ListClothID
                FROM   ListClothImage) AS a
               LEFT JOIN ListClothImage b
                      ON a.ListClothID = b.ListClothID)b
WHERE  rn = 1