Author |
Topic |
|
lofty
Junior Member
USA
158 Posts |
Posted - 31 January 2005 : 19:47:02
|
Hey,
I have a table that logs internal search queries on my site. Every time someone types something in the search bar, my code logs the search terms, the number of results, and the type of search that is performed (AND, OR, PHRASE). What I want to do is to count the number of times the different search types are used.
I have a column, searchType, that has text in it (each number corresponds to a row in the db):
searchType 1. OR 2. OR 3. OR 4. AND ...etc.
What I want to do is create a report that looks through that column, gets the distinct search types, and then counts each one like this:
AND 67 OR 517 PHRASE 23
If I do a (SELECT DISTINCT searchType FROM Search), I get this:
AND OR PHRASE
How can I get a recordset with the counts of the distinct items also?
Thanks, Adam |
|
Shaggy
Support Moderator
Ireland
6780 Posts |
Posted - 01 February 2005 : 06:05:37
|
Try:
SELECT DISTINCT searchType,COUNT(searchType) AS intCount FROM search GROUP BY searchType
|
Search is your friend “I was having a mildly paranoid day, mostly due to the fact that the mad priest lady from over the river had taken to nailing weasels to my front door again.” |
|
|
lofty
Junior Member
USA
158 Posts |
Posted - 01 February 2005 : 14:40:17
|
Beautiful, thanks a lot. |
|
|
|
Topic |
|
|
|