生了再结,记住!
授人以渔,不授人以鱼。
SQL SELECT 命令的完整语法显示如下: SELECT [ALL | DISTINCT] [TOP nExpr [PERCENT]] Select_List_Item [, ...] FROM [FORCE] Table_List_Item [, ...] [[JoinType] JOIN DatabaseName!]Table [[AS] Local_Alias] [ON JoinCondition [AND | OR [JoinCondition | FilterCondition] ...] [WITH (BUFFERING = lExpr)] [WHERE JoinCondition | FilterCondition [AND | OR JoinCondition | FilterCondition] ...] [GROUP BY Column_List_Item [, ...]] [HAVING FilterCondition [AND | OR ...]] [UNION [ALL] SELECTCommand] [ORDER BY Order_Item [ASC | DESC] [, ...]] [INTO StorageDestination | TO DisplayDestination] [PREFERENCE PreferenceName] [NOCONSOLE] [PLAIN] [NOWAIT] 说明 下面代码显示了主句摘要: 复制代码 SELECT Select_List FROM Table_List [WITH (BUFFERING = lExpr)] [WHERE Conditions] [GROUP BY Column_List] [UNION Clause] [HAVING Conditions] [ORDER BY Column_List] [INTO Clause | TO Clause ] [Additional_Display_Options]这么一大堆 不会用啊
*--- 生成乡镇数 SELECT LEFT(区划代码,6) QHDM,COUNT(*) JS FROM NJS WHERE LEN(ALLTRIM(区划代码))=9 GROUP BY 1 INTO CURSOR TEMP1 BROWSE *--- 生成村数 SELECT LEFT(区划代码,6) QHDM,COUNT(*) JS FROM NJS WHERE LEN(ALLTRIM(区划代码))=12 GROUP BY 1 INTO CURSOR TEMP2 BROWSE这是简单的,然后再把结果用第三个表连起来。