COUNT number of times text in records

G

gator

I have a field of names where there are multiple records of the same name. I
want to run a query on this showing a field of the name and a field of the
number of time it is listed in the dataset. What SQL will do this? I've
done it in Excel Pivot but I don't know how to convert it to SQL.
 
G

gator

something like......

TRANSFORM Count(Debits.[Name]) AS [CountOfName]
SELECT Debits.Name, Count(Debits.[Name]) AS NameTotal
FROM Debits
GROUP BY Debits.Name
PIVOT Debits.NameTotal;

.....this is as close as I can get but it doesn't work.
 
G

gator

the following SQL works, but it shows the Name as row header and field
header. I don't nee or want the field header....just the fields Name and
Total of Name......?

TRANSFORM Count(Debits.[Name]) AS [CountOfName]
SELECT Debits.Name, Count(Debits.[Name]) AS [Total Of Name]
FROM Debits
GROUP BY Debits.Name
PIVOT Debits.Name;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top