Obtain count of all possible values of a given column in psql

user1830307

I have a table t1 with a column c1, which is of type character(2), and has values ranging between 00:97. I am able to count the number of cases (7632) where c1 contains a single specific value (say 62):

SELECT count(*) FROM t1 WHERE c1='62';
 count 
-------
  7632
(1 row)

However, I am interested in obtaining the count for each of the possible values (00:97) that c1 can obtain. Is there such a syntax available in psql?

Erich Kitzmueller
select c1, count(*) from t1 group by c1 order by c1;

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Create all possible permutations of given variable set

분류에서Dev

Get all the possible combinations of the given numbers to reach at a given sum

분류에서Dev

Add column with accumulative count of unique values in a column

분류에서Dev

Join columns names with values of given column

분류에서Dev

How to count the sum of distinct Excel values in a column?

분류에서Dev

Using count for counting sets of values of integer column

분류에서Dev

List all .txt file and count number of column

분류에서Dev

CFDump of query column does not display all values

분류에서Dev

How to fetch all column values based on email?

분류에서Dev

How to repeat all column values for each row in another column

분류에서Dev

How to obtain removeView for a given appWidgetId in onReceive

분류에서Dev

Multiply column values in SQL, then add all the values - Laravel 4

분류에서Dev

All possible values for a record datatype in Z3?

분류에서Dev

sqlite select all rows where some columns are in set of possible values

분류에서Dev

Count Two Column Values Based on One Same Column in Two tables in mysql

분류에서Dev

Grabbing all rows from a database that have specific column values in laravel

분류에서Dev

How to get all the values of one column and calculate a total

분류에서Dev

Select distinct rows where all values in a column are the same SQL Server

분류에서Dev

What is the SQL query in Access to replace all column values with one of it's values, which depends on values of other attributes?

분류에서Dev

Obtain span HTML values to operate as array

분류에서Dev

Count all rows from a colum, and get 2 different count columns on the result (One for each possible value 1 or 0)

분류에서Dev

resolve all given the Type

분류에서Dev

mysql query: searching based on all values in column rather than one value in column

분류에서Dev

How to count data from a column in database which will have 3 different values and display it in Graph?

분류에서Dev

Is it Possible to not copy all 65,537 cells when copying a column in Open Office

분류에서Dev

Rails: group by the count of a column

분류에서Dev

Count number of 0 values

분류에서Dev

Obtain and store adjacent values from a .csv file (Python)

분류에서Dev

How do I obtain the duplicated values of two ArrayLists?

Related 관련 기사

  1. 1

    Create all possible permutations of given variable set

  2. 2

    Get all the possible combinations of the given numbers to reach at a given sum

  3. 3

    Add column with accumulative count of unique values in a column

  4. 4

    Join columns names with values of given column

  5. 5

    How to count the sum of distinct Excel values in a column?

  6. 6

    Using count for counting sets of values of integer column

  7. 7

    List all .txt file and count number of column

  8. 8

    CFDump of query column does not display all values

  9. 9

    How to fetch all column values based on email?

  10. 10

    How to repeat all column values for each row in another column

  11. 11

    How to obtain removeView for a given appWidgetId in onReceive

  12. 12

    Multiply column values in SQL, then add all the values - Laravel 4

  13. 13

    All possible values for a record datatype in Z3?

  14. 14

    sqlite select all rows where some columns are in set of possible values

  15. 15

    Count Two Column Values Based on One Same Column in Two tables in mysql

  16. 16

    Grabbing all rows from a database that have specific column values in laravel

  17. 17

    How to get all the values of one column and calculate a total

  18. 18

    Select distinct rows where all values in a column are the same SQL Server

  19. 19

    What is the SQL query in Access to replace all column values with one of it's values, which depends on values of other attributes?

  20. 20

    Obtain span HTML values to operate as array

  21. 21

    Count all rows from a colum, and get 2 different count columns on the result (One for each possible value 1 or 0)

  22. 22

    resolve all given the Type

  23. 23

    mysql query: searching based on all values in column rather than one value in column

  24. 24

    How to count data from a column in database which will have 3 different values and display it in Graph?

  25. 25

    Is it Possible to not copy all 65,537 cells when copying a column in Open Office

  26. 26

    Rails: group by the count of a column

  27. 27

    Count number of 0 values

  28. 28

    Obtain and store adjacent values from a .csv file (Python)

  29. 29

    How do I obtain the duplicated values of two ArrayLists?

뜨겁다태그

보관