Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic SQL Select displays No records

Status
Not open for further replies.

Javamahn

Technical User
Mar 14, 2001
143
US
Can someone tell me what is wrong with this statement?

SELECT Category, Count(*) as Cat_tot
FROM spam_audit_log group By Category
ORDER BY Cat_tot Desc

It collects from a mySQL database. If I execute this in mySQL-Front it gives me the records I need. If I use the same statement as a VBscript ASP page I get no data. It seems like a straight forward basic statement.
 
SELECT *
select all
SELECT some,some2,filed3

--> Count(*)

> need more info?
:: don't click HERE ::
 
Yes,it is a straight forward basic statement
How about this?

SELECT Category, Count(*)
FROM spam_audit_log
GROUP By Category
ORDER BY real_column_name

If this also will not work - delete ORDER BY line and try.
 
Another thought.

SELECT Category, Count(*)
FROM spam_audit_log
GROUP By Category
ORDER BY Count(*)DESC

My bet - it will not work because of (*) in ORDER BY Count(*)DESC

So, I'd try:

SELECT Category, Count(id)
FROM spam_audit_log
GROUP By Category
ORDER BY Count(id)DESC;

id - your autoNum column & can't have null values
 
...as I typed....perhaps I need to put more words to my "-->" part ...LOL

> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top