我有3列ID,名稱,值爲1,2,3,4,5/A,B,C,A,B/9,9,9,9,9所以我想要總數特殊名稱的SUM例如A-18,B-18,C-9 ...請以SQL形式回答查詢。SQL Inner Join related_Mahavir
-4
A
回答
0
SELECT name, SUM(value) FROM whatevertable GROUP BY name
+0
謝謝 - 很多! –
0
我假設您要求總計列&根據您的列名得到輸出。
選擇名稱+ ' - ' + LTRIM(RTRIM(STR(SUM(值))))從 表名組由名稱
+0
謝謝你的迴應 –
相關問題
- 1. INNER JOIN在SQL
- 2. INNER JOIN SQL QUERY
- 3. SQL INNER JOIN ON
- 4. Inner Join Pivot SQL
- 5. 慢SQL INNER JOIN
- 6. SQL INNER JOIN DISTINCT
- 7. SQL UNION INNER JOIN
- 8. SQL INNER JOIN實體
- 9. SQL ROW_NUMBER with INNER JOIN
- 10. SQL Inner Join 2 Tables
- 11. SQL SELECT + INNER JOIN + WHERE
- 12. INNER JOIN在SQL Server
- 13. COMPLEX SQL/SELECT - INNER JOIN
- 14. SQL Inner Join和Repeater
- 15. SQL INNER JOIN修復
- 16. SQL INNER JOIN DISTINCT RESULT
- 17. SQL Server 2005 INNER JOIN
- 18. OUTER JOIN VS INNER JOIN
- 19. mysql query join/inner join
- 20. 轉換INNER JOIN到左JOIN - SQL
- 21. INNER JOIN VS LEFT JOIN性能在SQL
- 22. 4桌INNER JOIN SQL語句
- 23. SQL Server INNER JOIN with hierarchid
- 24. 條件INNER JOIN在SQL Server
- 25. SQL子查詢或INNER-JOIN?
- 26. 複雜INNER JOIN SQL請求
- 27. SQL INNER JOIN不存在
- 28. SQL刪除查詢INNER JOIN
- 29. C#WPF SQL SELECT INNER JOIN
- 30. SQL INNER JOIN不給結果
你嘗試過什麼了嗎? – GurV
歡迎來到Stackoverflow。請顯示您的代碼,以證明您嘗試了多遠,並幫助其他成員更好地理解您的問題,同時提供您的問題背景。我建議您閱讀以下鏈接:https://stackoverflow.com/help/how-to-ask,http://stackoverflow.com/help/mcve –