µ±Ò»¸öSQLÓï¾ä´æÔÚwhere ¡¢ group by ¡¢order by ʱ£¬ÔËÐеÄ˳ÐòÊÇÔõôÑùµÄÄØ£¿ (8) SELECT (9) DISTINCT (11) <TOP_specification> <select_list> (1) from <left_table> (3) <join_type> JOIN <right_table> (2) ON <join_condition> (4) WHERE <where_condition> (5) GROUP BY <group_by_list> (6) WITH {CUBE | ROLLUP} (7) HAVING <having_condition> (10) ORDER BY <order_by_list>
Êý×Ö¾ÍÊÇ˳Ðò WITH {CUBE | ROLLUP}Õâ¸öÊÇʲôÒâË¼ÄØ£¿ ѧϰ
Çó×ܼơ¢ºÏ¼ÆµÄ SQL code: ---------------------------------------------------------------- -- Author :fredrickhu(СF£¬Ïò¸ßÊÖѧϰ) -- Date :2009-09-03 19:50:10 -- Verstion: -- Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86) -- Nov 24 2008 13:01:59 -- Copyright (c) 1988-2005 Microsoft Corporation -- Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 3) -- ---------------------------------------------------------------- --> ²âÊÔÊý¾Ý£º[tb] if object_id('[tb]') is not null drop table [tb] go create table [tb]([ÐÕÃû]