本文介绍了显示列的不同值的计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我想首先感谢所有花时间查看此主题并尝试提供帮助的人。



我会简短,并切入点:



我在MS Access中有一个表,它包含2列兴趣 - 县和TGTE(地热能类型)。列TGTE是VARCHAR类型,它可以有两个值中的一个,以便更容易让它说它是L或H.



我需要创建SQL查询这显示了一个下面描述的结果(代码标签是为了更清晰的外观):



贝娄是表的一部分:



县| TGTE | ......其他领域|
--------------------
首先| L |
首先| L |
首先| H |
第二个| H |
第三| L |





我需要一个结果查询,显示每个县的不同TGTE的数量,如下所示:



县| TGTE = L | TGTE = H | 
---------------------------------------------- -
首先| 2 | 1 |
第二个| 0 | 1 |
第三| 1 | 0 |





如何创建显示上面描述的期望结果?

解决方案




Hello everyone!

I would like to start by saying thanks to everyone who takes some time to view this thread and try to help.

I will be brief, and cut to the point:

I have a table in MS Access, it contains 2 columns of interest- County, and TGTE (Type Of Geothermal Energy ). Column TGTE is of type VARCHAR and it can have 1 of two values, to make it easier let's say it is either L or H.

I need to create SQL query that shows a result which is described bellow ( code tags are for clearer look ):

Bellow is the part of the table:

County | TGTE | ... other fields |
--------------------
First  |   L  |
First  |   L  |
First  |   H  |
Second |   H  |
Third  |   L  |



I need a resulting query that shows the count of distinct TGTE in every County like this:

County | TGTE = L | TGTE = H |
------------------------------------------------
First  |    2     |     1    |
Second |    0     |     1    |
Third  |    1     |     0    |



How can I create query that displays the desired result described above ?

解决方案




这篇关于显示列的不同值的计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 01:58