SQL: select distinct on column1 and sum up column2 values of merged rows

martinenzinger

How could one achieve to get sums of column values regarding tags in a second column?

tag1  1000
tag1  2000
tag2  1000
tag3  1000
tag2  3000
tag1  1000
tag3  1000
tag3  1000
tag2  2000
tag3  2000

The required result looks like this

tag1  4000
tag2  6000
tag3  5000
radar

GROUP BY on the tag column with sum

SELECT tagColumn, sum(tagValue) as TotalCount
FROM Table1
GROUP BY tagColumn

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

SELECT WHERE column1 = 1 AND column2 = MAX(column2)

分類Dev

Select rows where top n values of a certain column are distinct

分類Dev

SQL:column1でdistinctを選択し、マージされた行のcolumn2値を合計します

分類Dev

SELECT sql to return sum of values in columns of 3 rows as second column value and so on

分類Dev

SQL update column3 after group by column1 and compare value in column2

分類Dev

SQLで "column3" = "column1"-"column2"を作成する方法

分類Dev

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

分類Dev

Select all rows with the same value in column 1 but different values in columns 2 and 3 using SQL

分類Dev

SQL Server 2008 R2 : column1에 column2 값이있는 행 찾기

分類Dev

SQLでの「UPDATEtableSET column1 = value AND column2 value WHEREcondition」の意味は何ですか?

分類Dev

SQL - select where for specific id, all distinct values for other column exist

分類Dev

Excel - sum values based on distinct value in another column

分類Dev

Select distinct values from a column based on highest value in another column

分類Dev

Efficiently finding the count of column values for distinct rows in a dataframe in r

分類Dev

SELECT DISTINCT on one column

分類Dev

Dividing AVG of column1 by AVG of column2

分類Dev

SQL Server 2008 R2:column2の値がcolumn1に存在する行を検索します

分類Dev

SQLは、2行のcolumn1の値に基づいてcolumn2を選択します

分類Dev

SQL - Select values to become column values?

分類Dev

How to select distinct records from individual column in sql table

分類Dev

SQL Convert one column with distinct values into several columns

分類Dev

SQL server how to convert column values into rows

分類Dev

Filter group of rows based on sum of values from different column

分類Dev

Excel VBA Merge Duplicate rows and sum values in certain column

分類Dev

How to merge/insert values from column2 table1, to column2 table2, at the corresponding ID

分類Dev

MySQL SUM of one column, DISTINCT of ID column

分類Dev

Finding the maximum sum of a column for any 3 rows in SQL Server

分類Dev

Select rows from database where the value in one column is distinct and limit to 5 latest

分類Dev

Select SUM and column with max

Related 関連記事

  1. 1

    SELECT WHERE column1 = 1 AND column2 = MAX(column2)

  2. 2

    Select rows where top n values of a certain column are distinct

  3. 3

    SQL:column1でdistinctを選択し、マージされた行のcolumn2値を合計します

  4. 4

    SELECT sql to return sum of values in columns of 3 rows as second column value and so on

  5. 5

    SQL update column3 after group by column1 and compare value in column2

  6. 6

    SQLで "column3" = "column1"-"column2"を作成する方法

  7. 7

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

  8. 8

    Select all rows with the same value in column 1 but different values in columns 2 and 3 using SQL

  9. 9

    SQL Server 2008 R2 : column1에 column2 값이있는 행 찾기

  10. 10

    SQLでの「UPDATEtableSET column1 = value AND column2 value WHEREcondition」の意味は何ですか?

  11. 11

    SQL - select where for specific id, all distinct values for other column exist

  12. 12

    Excel - sum values based on distinct value in another column

  13. 13

    Select distinct values from a column based on highest value in another column

  14. 14

    Efficiently finding the count of column values for distinct rows in a dataframe in r

  15. 15

    SELECT DISTINCT on one column

  16. 16

    Dividing AVG of column1 by AVG of column2

  17. 17

    SQL Server 2008 R2:column2の値がcolumn1に存在する行を検索します

  18. 18

    SQLは、2行のcolumn1の値に基づいてcolumn2を選択します

  19. 19

    SQL - Select values to become column values?

  20. 20

    How to select distinct records from individual column in sql table

  21. 21

    SQL Convert one column with distinct values into several columns

  22. 22

    SQL server how to convert column values into rows

  23. 23

    Filter group of rows based on sum of values from different column

  24. 24

    Excel VBA Merge Duplicate rows and sum values in certain column

  25. 25

    How to merge/insert values from column2 table1, to column2 table2, at the corresponding ID

  26. 26

    MySQL SUM of one column, DISTINCT of ID column

  27. 27

    Finding the maximum sum of a column for any 3 rows in SQL Server

  28. 28

    Select rows from database where the value in one column is distinct and limit to 5 latest

  29. 29

    Select SUM and column with max

ホットタグ

アーカイブ