ASP/SQL Question

S

SyrOrange

I have an SQL command and recordset using ASP

<%
strSQL = "SELECT Count(*) AS MonitorsDeployed FROM Monitors Where
Status='Deployed'"
rs.Open strSQL, conn, 3, 3
response.write(rs("MonitorsDeployed"))
%>

Is there a way to have create variables based on other criteria or do I need
a separate recordset for each one.

For example, I have monitors with status' of "Deployed", "Storage", "Broken"
and I want the count of these. Is there an easier way?
 
R

Ray Costanzo [MVP]

SELECT COUNT(yourIDcolumn),Status FROM Monitors GROUP BY Status

That should return a recordset like

100 Deployed
29 Broken
45 Storage

Ray at work
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,901
Members
47,439
Latest member
elif2sghost

Latest Threads

Top