摘要:
-----内联结3个表返回产品的折扣信息-----SELECT p.Name,s.DiscountPct from Sales.SpecialOffer sinner JOIN Sales.SpecialOfferProduct o ONs.SpecialOfferID=o.SpecialOfferIDINNER JOIN Production.Product p ONo.ProductID=p.ProductIDWHERE p.Name ='All-Purpose Bike Stand'-----外联结2个表返回税率状态、省-----SELECT s.CountryRegio 阅读全文
posted @ 2011-12-26 23:27
韩梦芫
阅读(243)
评论(0)
推荐(0)
摘要:
------使用distinct消除重复值----use AdventureWorksselect distinct HireDatefrom HumanResources.Employee-----在聚合函数中使用distinct ----------如果你想计算产品列表的平均价格,可以使用如下查询语句----select AVG(ListPrice) from Production.Product-----使用列别名-----select Color as 'Grouped Color', AVG(DISTINCT ListPrice) as 'Average Di 阅读全文
posted @ 2011-12-26 23:25
韩梦芫
阅读(174)
评论(0)
推荐(0)

浙公网安备 33010602011771号