'mysql : how to fillter the columns data
i have table(matchdetail) like below
txtProjectdate | txtProjectGroup | txtMember
------------------------------------------------------
2022-03-01T00:00:00 | AMT | steve
2022-03-01T00:20:00 | SSIT | Parvq
2022-03-01T01:05:00 | AMT | Parvq
2022-03-01T01:05:00 | VALOK | Shveas
2022-03-01T01:05:00 | RPC | modi
2022-03-01T01:05:00 | VALOK | khan
2022-03-01T01:05:00 | AMT | lkhmi
2022-03-01T01:05:00 | BIK | lkhmi
2022-03-01T01:06:00 | AMT | steve
|
and i required output as below, Is it at all possible to receive result like below?
txtProjectGroup | Count | txtMember
------------------------------------
AMT | 2 | steve
VALOK | 1 | Shveas
RPC | 1 | modi
VALOK | 1 | khan
SSIT | 1 | Parvq
BIK | 1 | lkhmi
AMT | 1 | Parvq
AMT | 1 | lkhmi
Solution 1:[1]
You have to use an aggregation function like COUNT and the GROUP BY clause to identify the fields you want to group on:
SELECT
txtProjectGroup,
COUNT(txtProjectdate) AS Count
txtMember,
FROM
table
GROUP BY
txtProjectGroup,
txtMember
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | lemon |
