Hey guys need a little help here.
My database table is set up like so
UserFileName | FirstName | LastName |UserID
Data inside is something like
Dave’s DB 1 | John | Doe | test3
Dave’s DB 1 | Jane | Doe | test3
Dave’s DB 4 | John | Doe | test3
Dave’s DB 5 | John | Doe | test3
So what I need to do here is count the amount of records for all the records in this table where for example UserFileName = Dave’s DB 1
I need a count for everything in this table where the UserFileName is the same. So my end result would have a serperate count for all Dave’s DB 1 records, Dave’s DB 4 records, etc…
Dave’s DB 1 count = 2
Dave’s DB 4 count = 1
Dave’s DB 5 count = 1
If I use the count SQL command it’s returning the of course the total record count in the table which is incorrect. The UserFileName is variable so I can’t hard code the values in the WHERE clause. I was thinking of sticking every record with the same UserFileName in an array and just base the counting on the array length.
I’m no SQL pro - so I’m hoping there is a way of doing this in the SQL command that I just don’t know about.
Thanks yo!