954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

MSSQL and ASP Query

Hi All

I am hoping you may be able to help me with a general query I have, I am working on a small script to query our MSSQL database, it is basically a database of search terms, i.e.

Term, Date
help me, 22-10-2006
searchfor, 22-10-2006

What I want to do, and this is more of an query question than VBScript is how I can pull the data from MSSQL to show the most searched for terms, i.e.

Help - exists 302 times in the database
Term - exists 290 times in the database..

I have tried SELECT DISTINCT but that just gives me a number, and I don't know how to count them as they are dynamic.

Any help gratefully appreciated!

Thanks

John

Jon.B
Newbie Poster
2 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

i think you want:

select count(term), term from TableName group by term
campkev
Posting Pro in Training
484 posts since Jul 2005
Reputation Points: 14
Solved Threads: 19
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You