Thanks everybody. I'd been trying to figure this out for a while. I was using local variables with a case function which apparently don't work in a select statement. I even posed the question to a local SQL users group that meets on Microsoft campus, they thought it was an odd question too. Aah, the life of datamining.
I was able to get Batgirl's query to work. I love the linear regression idea, too. Maybe that will be the next version. I need to figure what values to assign!
Sean, I tried yours but got lost somewhere. Probably because I have several conditions (i.e. where clauses) that I don't want in the count but are universal. I figure if I filter by those first it will speed up the query.
So here is my slight modification of Batgirls query.
SELECT *
FROM table
WHERE
--these UniversalConditions (where clauses) are mandatory all must be true
UniversalCondition1
UniversalCondition2
UniversalCondition3
UniversalCondition4
--inside the Case Statement are Variable Conditions where I will accept 8
--out of 10
(
CASE
WHEN condition1 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition2 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition3 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition4 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition5 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition6 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition7 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition8 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition9 = 'xxx'
THEN 1
ELSE 0
END + CASE
WHEN condition10 = 'xxx'
THEN 1
ELSE 0
END
) >= 8
Is there always one more question?
Mine is, "is there a way to have the total count display as well?" In other words, is this row a "10" a "9" or an "8"?