C
cliff
HI Karl, I would like to give you details of structure and data. Mydata
contains say about 10 nos.
N1
12
23
31
17
16
8
5
10
19
24
2
out of which I want to select Five Nos at a time. While selected should meet
criteria set for various groups of nos. Rules are put in a table called
tbl_Rules and value in other table called tbl_Rule_values. Rules like :-
1. Of Five. Minimum odd nos should be 1 and Maximum 4 and likewise
2. of five , Mimumum 1 should be even and Maximum 3 etc
I have the following query to select five nos from mytable
qry_rndnum
SELECT TOP 5 mytable.n1
FROM mytable
WHERE (((randomizer())=0))
ORDER BY Rnd(IsNull(mytable.n1)*0+1);
I have following query to check wthether selected nos fulfill set rules
SELECT tbl_Rules.RuleID, tbl_Rules.RuleDesc,
tbl_Rules.RuleMin, tbl_Rules.RuleMax,
Count(qry_RndNum.[RndVal]) AS RuleCount
FROM (tbl_Rules INNER JOIN tbl_Rule_Values
ON tbl_Rules.RuleID=tbl_Rule_Values.RuleID)
INNER JOIN qry_RndNum
ON tbl_Rule_Values.RuleVal=tbl_RndNum.RndVal
GROUP BY tbl_Rules.RuleID, tbl_Rules.RuleDesc,
tbl_Rules.RuleMin, tbl_Rules.RuleMax
HAVING Count(qry_RndNum.[RndVal])<[RuleMin]
OR Count(qry_RndNum.[RndVal])>[RuleMax]
suppose randomly selected nos from mytable are 12 ,31,16,5,24 I want to
display message that "selected nos fulfilled all condtions" and I want save
nos in a table for future reference. In case, some of the conditions are
not met then, I want to display message say "7 condtions are not fulfilled"
etc and delete the selected nos and try again to select another set of nos..
can u tell me how to do it?
thanks lot
contains say about 10 nos.
N1
12
23
31
17
16
8
5
10
19
24
2
out of which I want to select Five Nos at a time. While selected should meet
criteria set for various groups of nos. Rules are put in a table called
tbl_Rules and value in other table called tbl_Rule_values. Rules like :-
1. Of Five. Minimum odd nos should be 1 and Maximum 4 and likewise
2. of five , Mimumum 1 should be even and Maximum 3 etc
I have the following query to select five nos from mytable
qry_rndnum
SELECT TOP 5 mytable.n1
FROM mytable
WHERE (((randomizer())=0))
ORDER BY Rnd(IsNull(mytable.n1)*0+1);
I have following query to check wthether selected nos fulfill set rules
SELECT tbl_Rules.RuleID, tbl_Rules.RuleDesc,
tbl_Rules.RuleMin, tbl_Rules.RuleMax,
Count(qry_RndNum.[RndVal]) AS RuleCount
FROM (tbl_Rules INNER JOIN tbl_Rule_Values
ON tbl_Rules.RuleID=tbl_Rule_Values.RuleID)
INNER JOIN qry_RndNum
ON tbl_Rule_Values.RuleVal=tbl_RndNum.RndVal
GROUP BY tbl_Rules.RuleID, tbl_Rules.RuleDesc,
tbl_Rules.RuleMin, tbl_Rules.RuleMax
HAVING Count(qry_RndNum.[RndVal])<[RuleMin]
OR Count(qry_RndNum.[RndVal])>[RuleMax]
suppose randomly selected nos from mytable are 12 ,31,16,5,24 I want to
display message that "selected nos fulfilled all condtions" and I want save
nos in a table for future reference. In case, some of the conditions are
not met then, I want to display message say "7 condtions are not fulfilled"
etc and delete the selected nos and try again to select another set of nos..
can u tell me how to do it?
thanks lot