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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EASY: Counting records 2

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
0
0
US
what is the sql command to count a number of records that are returned in a query?
 
select count(*)
from mytable
where mytable.field = 'something'
 
thanks... this is a little OT for this forum but would anyone know how I would then refer to what is returned in an asp page? Like when I want to refer to a db field I say:
<%=rs(&quot;field&quot;)%>

How would I call the count that is returned?
 
Give the count a name and it will part of the fields collection just like any other field, otherwise, it will have some default name which you could lookup in the field collection if you wanted.


select count(*) as cnt
from mytable
where mytable.field = 'something'

<%=rs(&quot;cnt&quot;)%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top