日期:2014-05-19  浏览次数:20665 次

疑问。。大家帮忙看看
SQL帮助里有一个例子   排序的
USE   pubs
SELECT   type,   pub_id,   AVG(price)   AS   'avg ',   sum(ytd_sales)   AS   'sum '
FROM   titles
GROUP   BY   type,   pub_id
ORDER   BY   type,   pub_id

-----------
我修改了一下
USE   pubs
SELECT   type,   pub_id,   sum(price)   AS   'pricesum ',   sum(ytd_sales)   AS   'salesum '
FROM   titles
GROUP   BY   type,   pub_id
ORDER   BY     pricesum,   salesum   desc  
-----------
但是得到的结果   和我想象的不一样的
请问如何修改才能让它   先安pricesum   降序排列再安salesum     降序排列

------解决方案--------------------
USE pubs
SELECT type, pub_id, sum(price) AS 'pricesum ', sum(ytd_sales) AS 'salesum '
FROM titles
GROUP BY type, pub_id
ORDER BY pricesum desc , salesum desc