hi

i have a query of a query which has the columns:

subjectID, testOccasionID, and x amount of columns additional that i will not 
always know what they are named

i need to be able to query this as follows:

only return those rows where the subject has more than 1 test occasion

thats the first part and im not sure how i would do a count on this?

the second part is that a subject may have several rows of data for each test 
occasion in the query, for example:

subjectID    testOccasionID     col1     col2    etc...
-------------------------------------------------------
1                1               a        x       x
1                1               b        x       x
1                2               c        x       x
2                1               a        x       x
3                1               a        x       x 
4                1               a        x       x
4                2               a        x       x

so i want it to return all rows where for those subjects that have a test 
occasion count greater than 2

the first thing to note is that i cannot do a count on subject 1 as he has got 
2 rows of data for test occasion 1, so if i try to count the subjectid and test 
occasion id it would indicate that subject 1 has got 3 test occasions but he 
only has 2, so i am assuming i will need to use some kind of distinct statement

subjects 2 and 3 only have 1 test occasion so they will be left out. the query 
i need returned from the above is:

subjectID    testOccasionID     col1     col2    etc...
-------------------------------------------------------
1                1               a        x       x
1                1               b        x       x
1                2               c        x       x
4                1               a        x       x
4                2               a        x       x

i dont know how to put all this together in a query of query that will work 
though and would really appreciate any help

i hope i have made this clear

thanks very much

richard 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308949
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to