SELECT 奶牛登记卡.所在乡镇, "合计" as 合计, Sum(奶牛登记卡.奶牛存栏) AS 奶牛存栏, Sum(奶牛登记卡.可繁) AS 可繁, Sum(奶牛登记卡.育成) AS 育成, Sum(奶牛登记卡.泌乳) AS 泌乳之, Sum(奶牛登记卡.犊牛) AS 犊牛, Sum(奶牛登记卡.青贮窖) AS 青贮窖, Sum(奶牛登记卡.青贮量) AS 青贮量, Sum(奶牛登记卡.牛舍面积) AS 牛舍面积, Sum(奶牛登记卡.[2001年商品奶量]) AS 2001年商品奶量, Sum(奶牛登记卡.[2002年预计商品奶量]) AS 2002年预计商品奶量
FROM 奶牛登记卡
GROUP BY 奶牛登记卡.所在乡镇
HAVING (((奶牛登记卡.所在乡镇)="二道湾镇" Or (奶牛登记卡.所在乡镇)="友谊乡" Or (奶牛登记卡.所在乡镇)="富裕镇" Or (奶牛登记卡.所在乡镇)="龙安桥镇" Or (奶牛登记卡.所在乡镇)="繁荣乡" Or (奶牛登记卡.所在乡镇)="绍文乡" Or (奶牛登记卡.所在乡镇)="忠厚乡" Or (奶牛登记卡.所在乡镇)="塔哈乡" Or (奶牛登记卡.所在乡镇)="富路镇" Or (奶牛登记卡.所在乡镇)="富海镇"));
UNION SELECT 所在乡镇, "" as 合计, 奶牛存栏, 可繁, 育成, 泌乳, 犊牛, 青贮量, 青贮窖, 牛舍面积, [2001年商品奶量], [2002年预计商品奶量]
FROM 奶牛登记卡
WHERE (((奶牛登记卡.所在乡镇)="二道湾镇" Or (奶牛登记卡.所在乡镇)="友谊乡" Or (奶牛登记卡.所在乡镇)="富裕镇" Or (奶牛登记卡.所在乡镇)="龙安桥镇" Or (奶牛登记卡.所在乡镇)="繁荣乡" Or (奶牛登记卡.所在乡镇)="绍文乡" Or (奶牛登记卡.所在乡镇)="忠厚乡" Or (奶牛登记卡.所在乡镇)="塔哈乡" Or (奶牛登记卡.所在乡镇)="富路镇" Or (奶牛登记卡.所在乡镇)="富海镇"))
ORDER BY 所在乡镇;
哈哈,与楼上老兄同出一辙!
[此贴子已经被zhuyiwen于2002-4-13 15:47:46编辑过]
|