|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I am running a SQL query and want to either run two aggregate functions, Distinct, and Count) I have deemed this impossible so now I turn to the other side of the choice.
I know there is a way in Cold fusion to count the rows, (only of the returned records )in a query as a numeric. I have done this before and I wish I had saved the programming but I did not. Well I will have to dig if no one has it. I want to count the total records returned for two of the fields in the query only. Any ideas? |
|
#2
|
||||
|
||||
|
<cfset count = yourQueryName.recordcount>
|
|
#3
|
|||
|
|||
|
I don't understand what you mean when you say you "want to count the total records returned for two of the fields". You either want the recordcount of the number of rows returned by the query (irregardless of any specific field) or you want a count of how many rows in the query had the same value in one or more of the fields. The first you can do with myQuery.recordCount (as already stated). The second you'll either have to do in the query itself with the count() aggregate function or you'll have to loop over the query and count them up manually. Obviously doing this in the SQL would be highly preferred.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Counting Rows.... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|