AdventureWorks2012: Sql For each customer, determine the number of orders created in year 2007. If a customer has not created any order in year 2004, show 0 for that customer. Show: customer ID, # of orders created in 2007.
相关问题
- How do I get values for all months in T-SQL
- Why can't I connect to a SQL Server 2012 Local
- Silent Install of SQL Server Express 2012 from Inn
- sql server restoring back up error
- Wait on the Database Engine recovery handle failed
相关文章
- Why can't I connect to a SQL Server 2012 Local
- Silent Install of SQL Server Express 2012 from Inn
- sql server restoring back up error
- Wait on the Database Engine recovery handle failed
- System.Data.SqlClient.SqlException: - ASP.NET MVC
- 远程SQL Server连接字符串(Remote SQL Server connection str
- 不能附加在SQL Server中的示例数据库2012 [关闭](Can't attach t
- 不能附加在SQL Server中的示例数据库2012 [关闭](Can't attach t
Same approach as in my other response - use a CTE (Common Table Expression) to determine number of sales for each customer in the year 2007:
Ordered the output by number of sales descending, so you'll get the customer with the most sales first