select * from MyTable;
where iif(q1a > 2, 1, 0) + iif(q1b, 1, 0);
+ iif(q1c, 1, 0) + iif(q1d, 1, 0) >= 2;
or iif(q2a > 2, 1, 0) + iif(q2b, 1, 0);
+ iif(q2c, 1, 0) + iif(q2d, 1, 0) >= 2;
into cursor temp
The above reflects the interpretation that more "2 or more of the q1's" are OK. If you need "exactly 2", change the ">=" to "=".
HTH,
Hilmar.
>Hi ppl,
>
>I need a little help with a sql statement
>
>I have 8 fields like this q1a,q1b,q1c,q1d,q2a,q2b,q2c,q2d
>
>each field is int()
>values can be from 0 to 4
>
>I need to only return a result set if 2 of the q1's values are greater than 2 or 2 of the q2's values are greater than 2
>
>This will be running as a stored proc in SQL
>
>
>Thanks in advance
>
>Paul
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)