PC Review


Reply
Thread Tools Rate Thread

COUNT number of times text in records

 
 
gator
Guest
Posts: n/a
 
      3rd Jun 2010
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.
 
Reply With Quote
 
 
 
 
gator
Guest
Posts: n/a
 
      3rd Jun 2010
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.

"gator" wrote:

> 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.

 
Reply With Quote
 
 
 
 
gator
Guest
Posts: n/a
 
      3rd Jun 2010
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;


"gator" wrote:

> 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.

 
Reply With Quote
 
gator
Guest
Posts: n/a
 
      3rd Jun 2010
never mind...I got it

"gator" wrote:

> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
count text appear how many times & put in respec col??eg 1st times Piglet Microsoft Excel Misc 3 29th May 2008 07:53 AM
how do I count the number of times text in column A matches text i =?Utf-8?B?U2hlaWxh?= Microsoft Excel Worksheet Functions 2 16th Nov 2005 11:20 PM
Count number of times a specific number is displayed in a cell ran =?Utf-8?B?c3Vicw==?= Microsoft Excel Worksheet Functions 1 27th Jun 2005 05:01 PM
Count number of times a specific number is displayed in cells =?Utf-8?B?c3Vicw==?= Microsoft Excel Programming 1 27th Jun 2005 03:15 PM
Query appends duplicate records, 2 times, 3 times, 4 times etc Randy Microsoft Access Queries 11 5th Feb 2005 09:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:57 AM.