Merry Meet Robert,
You can't put you if inside your query. It wont work. As you've seen. Use
this instead.
cfquery name="Get" datasource="wweb"
SELECT id, cbi, count(cbi) as cbicount
FROM wweb
Where cbi like 'CBI'
/cfquery
CFOUTPUT
#get.cbiCount#
/CFOUTPUT
That should work for you.
ubject: RE: data in columns
you could just try the count(*) operator.
SELECT count(*) as thecount
FROM wweb
Where
cbi like 'CBI' AND cbi IS NOT NULL
this will give you a variabel queryname.thecount where cbi is equal to 'CBI'
and cbi is not null.
chris olive, cio
cresco technolog
1) Pull the cfset out of the cfquery block
2) You are searching on LIKE 'CBI', but testing on EQ 'CBI'; are you sure
about the values?
3) Select count(cbi) as cbicount
from wweb
where cbi = 'CBI'
-Original Message-
From: Robert Orlini [mailto:[EMAIL
Thanks for everyone's feedback on this! I got it going w/the "Select Count".
Robert O.
-Original Message-
From: Hayes, David [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 18, 2001 2:22 PM
To: CF-Talk
Subject: RE: data in columns
1) Pull the cfset out of the cfquery blo
Use the Database to do the hard part:
cfquery name="Get" datasource="wweb"
SELECT count(cbi) as cbicount
FROM wweb
Where cbi like 'CBI'
/cfquery
CFOUTPUT
#wweb.cbiCount#
/CFOUTPUT
-Original Message-
From: Robert Orlini [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 18,
try this
cfquery name="Get" datasource="wweb"
SELECT id, cbi
FROM wweb
Where cbi = 'CBI'
/CFQUERY
CFOUTPUT
#Get.RecordCount#
/CFOUTPUT
HTH
Mike
-Original Message-
From: Robert Orlini [mailto:[EMAIL
you could just try the count(*) operator.
SELECT count(*) as thecount
FROM wweb
Where
cbi like 'CBI' AND cbi IS NOT NULL
this will give you a variabel queryname.thecount where cbi is equal to 'CBI'
and cbi is not null.
chris olive, cio
cresco technologies
[EMAIL PROTECTED]
If you are already selecting only the rows where cbi like 'CBI' then you will not get
any of the rows where cbi is empty so you
could just use the variable get.recordcount to get a count of rows.
PS
You cannot to my knowledge use the cf set as you have there referencing a column in
the query
First, try using where cbi like 'CBI%'
Second, you can just use #Get.recordcount# to return the number of records you query
finds.
--Nathan
Robert Orlini wrote:
Hello,
I'm still a newbie with this one though I've tried. How can I count data in
certain columns of a table for each
9 matches
Mail list logo