I know the answer to my problem is easy I just can't seem to get my brain
functioning today. 

My problem is that I want to get the number of times an integer ID appears
in a list of columns for every row in a table. The integer ID is from an
outer SQL statement that I am looping through. 

An example
Current ID = 1
DBColumn 1  DBColumn 2
--------    --------
    1          1
    2          1
    1          1
The result should be 5. The second time I loop through the outer sql
statement the ID would be 2 and the result should = 1

Here is what the current SQL statement looks like:
SELECT Count(*) as Total FROM Cycles WHERE (BrandNameID1_1=#LoopIndex# OR
BrandNameID2_1=#LoopIndex# OR BrandNameID3_1=#LoopIndex# OR
BrandNameID1_2=#LoopIndex# OR BrandNameID2_2=#LoopIndex# OR
BrandNameID3_2=#LoopIndex# OR BrandNameID1_3=#LoopIndex# OR
BrandNameID2_3=#LoopIndex# OR BrandNameID3_3=#LoopIndex#)

This however returns only the number of rows that have the loop index in it.

I know there is probably an easy solution to this but for the life of me I
can't think straight today. 

Any help would be greatly appreciated. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to