------使用distinct消除重复值----use AdventureWorksselect distinct HireDatefrom HumanResources.Employee-----在聚合函数中使用distinct ----------如果你想计算产品列表的平均价格,可以使用如下查询语句----select AVG(ListPrice) from Production.Product-----使用列别名-----select Color as 'Grouped Color', AVG(DISTINCT ListPrice) as 'Average Distinct List Price',AVG(ListPrice) 'Average List Price'from Production.Productgroup by Coloruse AdventureWorks-----对结果排序-----select select_list[INTO new_table_name]from table_list[WHERE search_conditions][GROUP BY group_by_list][HAVING search_conditions][ORDER by order_list [ASC | DESC]]