You need to group by Date, also.
I tested your data . I chose to modify Date format and rename fields and saved file as EntryInfo.
Table for testing:
Code:
MDate MType Num Mname Action Event
12/20/14 Cards 4635 CB-067 Admit EXIT_GATE
12/20/14 Cards 4635 CB-067 Admit ENTRY_GATE
12/19/14 Cards 4635 CB-067 Admit EXIT_GATE
12/18/14 Cards 4635 CB-067 Admit ENTRY_GATE
12/17/14 Cards 4635 CB-067 Admit EXIT_GATE
12/17/14 Cards 4635 CB-067 Admit ENTRY_GATE
12/15/14 Cards 4635 CB-067 Admit EXIT_GATE
12/14/14 Cards 4635 CB-067 Admit ENTRY_GATE
12/14/14 Cards 4635 CB-067 Admit EXIT_GATE
12/14/14 Cards 4635 CB-067 Admit ENTRY_GATE
SQL for query EntriesByDate
Code:
SELECT EntryInfo.Mname, EntryInfo.MDate
FROM EntryInfo
GROUP BY EntryInfo.Mname, EntryInfo.MDate;
Result:
Code:
Mname |
MDate |
CB-067 |
14/12/2014 |
CB-067 |
15/12/2014 |
CB-067 |
17/12/2014 |
CB-067 |
18/12/2014 |
CB-067 |
19/12/2014 |
CB-067 |
20/12/2014 |
Then use the first query to get count.
Code:
SELECT EntriesByDate.Mname, Count(EntriesByDate.MDate) AS CountOfMDate
FROM EntriesByDate
GROUP BY EntriesByDate.Mname;
Result -final:
Code:
Mname |
CountOfMDate |
CB-067 |
6 |
Good luck.