日期:2014-05-17 浏览次数:20560 次
859 ASX劲炫(进口) 19.80 859 ASX劲炫(进口) 22.30 859 ASX劲炫(进口) 23.30 859 ASX劲炫(进口) 25.50 859 ASX劲炫(进口) 18.38 859 ASX劲炫(进口) 19.80 859 ASX劲炫(进口) 20.80 859 ASX劲炫(进口) 21.80 859 ASX劲炫(进口) 23.98
WITH test (id,NAME,number) AS ( SELECT '859', 'ASX劲炫(进口)', 19.80 UNION ALL SELECT '859', 'ASX劲炫(进口)', 22.30 UNION ALL SELECT '859', 'ASX劲炫(进口)',23.30 UNION ALL SELECT '859', 'ASX劲炫(进口)', 25.50 UNION ALL SELECT '859', 'ASX劲炫(进口)', 18.38 UNION ALL SELECT '859', 'ASX劲炫(进口)', 19.80 UNION ALL SELECT '859', 'ASX劲炫(进口)', 20.80 UNION ALL SELECT '859', 'ASX劲炫(进口)', 21.80 UNION ALL SELECT '859', 'ASX劲炫(进口)', 23.98 ) SELECT id,name,MAX(number) [max],MIN(number)[min] FROM test GROUP BY id,name /* id name max min ---- ------------- --------------------------------------- --------------------------------------- 859 ASX劲炫(进口) 25.50 18.38 (1 行受影响) */