C
Chet.Horton
Guest
I got a query from a question I asked earlier. It worked perfectly. I wanted to count the total number of entries for each student and display their total in a datagridview.
Here is the query that worked.
SELECT
FirstName AS [First Name],
LastName AS [Last Name],
TrainDate AS [Training Date], Count(*) AS TotalCount
FROM
ACJATTENDANCE
GROUP BY FirstName, LastName, TrainDate, TrainDate;
Here is my modification that doesn't work. It displays every entry for every user.
ID LastName FirstName TrainDate Classes
3 Smith Joe 3/1/2020 1
3 Smith Joe 3/1/2020 1
3 Harris Jason 3/15/2020 1
Instead of...
ID LastName FirstName TrainDate Classes
3 Smith Joe 3/1/2020 2
1 Harris Jason 3/15/2020 1
"SELECT
ID AS [STUDENT ID],
FirstName AS [First Name],
LastName AS [Last Name],
TrainDate AS [Training Date], Count(*) AS TotalCount
FROM
ACJATTENDANCE
GROUP BY ID, LastName, FirstName, TrainDate, TrainDate;"
Continue reading...
Here is the query that worked.
SELECT
FirstName AS [First Name],
LastName AS [Last Name],
TrainDate AS [Training Date], Count(*) AS TotalCount
FROM
ACJATTENDANCE
GROUP BY FirstName, LastName, TrainDate, TrainDate;
Here is my modification that doesn't work. It displays every entry for every user.
ID LastName FirstName TrainDate Classes
3 Smith Joe 3/1/2020 1
3 Smith Joe 3/1/2020 1
3 Harris Jason 3/15/2020 1
Instead of...
ID LastName FirstName TrainDate Classes
3 Smith Joe 3/1/2020 2
1 Harris Jason 3/15/2020 1
"SELECT
ID AS [STUDENT ID],
FirstName AS [First Name],
LastName AS [Last Name],
TrainDate AS [Training Date], Count(*) AS TotalCount
FROM
ACJATTENDANCE
GROUP BY ID, LastName, FirstName, TrainDate, TrainDate;"
Continue reading...