Forums
This topic is locked
Inserting an SQL Count() Statement
Posted 03 Feb 2003 21:21:36
1
has voted
03 Feb 2003 21:21:36 Jeremy Kratz posted:
I'm trying to insert a simple SQL Count() statement to return the number of records that match a given criteria. Does anyone have the syntax for this statement, or, better yet, a step-by-step walkthrough of how to insert this query? I'm not sure if I have to define a separate Recordset or not, and the "Advanced" mode in Create Recordset is little help.
Replies
Replied 04 Feb 2003 09:45:04
04 Feb 2003 09:45:04 Julio Taylor replied:
best thing is to make a separate recordset. in the advanced recordset section, write something like this
<pre id=code><font face=courier size=2 id=code>
SELECT COUNT(fieldname) FROM tablename
</font id=code></pre id=code>
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
<pre id=code><font face=courier size=2 id=code>
SELECT COUNT(fieldname) FROM tablename
</font id=code></pre id=code>
------------------------
Julio
PHP | MySQL | DWMX | ColdFusion
ICQ: 19735247
Replied 06 Feb 2003 17:06:36
06 Feb 2003 17:06:36 Dennis van Galen replied:
you can also try this:
www.dmxzone.com/go?4340
or if you run CFMX just use the following:
<pre id=code><font face=courier size=2 id=code> <cfoutput>Total records found that match your criteria: #myquery.recordcount#</cfoutput> </font id=code></pre id=code>
HTH.
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5
www.dmxzone.com/go?4340
or if you run CFMX just use the following:
<pre id=code><font face=courier size=2 id=code> <cfoutput>Total records found that match your criteria: #myquery.recordcount#</cfoutput> </font id=code></pre id=code>
HTH.
with regards,
Dennis van Galen
DMXzone Manager
Extension, Tutorial and FAQ's Manager
Studio MX / CFMX PRO / SQL 2000 / NT4 AND win2kPRO / IIS5