hello experts
I'm going to push my luck a bit and ask 2 different questions in one day!
thanks to help from this forum I produce tables like TblA below. My final problem is how to eliminate some of the ID's in TblA based on values found in TblB.
now, TblB shows 4 values that CAN'T IMMEDIATELY FOLLOW each value of TheVal. for example, TheVal = 18 in TblA cannot be immediately followed by TheVal = 4, 11, 16 or 43. But TheVal = 18 CAN be followed immediately by any other values, just not these four restricted ones. Because TblA has a violation where 11 immediately follows 18, then ALL of the ID=2 values must be rejected. As long as there are no other violations, the final query output would look like:
much thanks for any clues. I can actually do this in VBA, but I'm gradually realizing how powerful and efficient SQL can be.
TQ, Terry W.
I'm going to push my luck a bit and ask 2 different questions in one day!
thanks to help from this forum I produce tables like TblA below. My final problem is how to eliminate some of the ID's in TblA based on values found in TblB.
Code:
TblA TblB
ID TheVal CountOfID TheVal CantFollow
1 34 1 ...... ......
1 21 2
1 19 3 18 4
1 15 4 18 11
1 12 5 18 16
1 8 6 18 43
2 77 1 19 0
2 29 2 19 14
2 18 3 19 16
2 11 4 19 31
2 10 5 20 7
2 9 6 20 19
5 99 1 20 45
5 54 2 20 54
5 45 3 ...... ......
5 33 4
5 12 5
5 1 6
now, TblB shows 4 values that CAN'T IMMEDIATELY FOLLOW each value of TheVal. for example, TheVal = 18 in TblA cannot be immediately followed by TheVal = 4, 11, 16 or 43. But TheVal = 18 CAN be followed immediately by any other values, just not these four restricted ones. Because TblA has a violation where 11 immediately follows 18, then ALL of the ID=2 values must be rejected. As long as there are no other violations, the final query output would look like:
Code:
TblA
ID TheVal CountOfID
1 34 1
1 21 2
1 19 3
1 15 4
1 12 5
1 8 6
5 99 1
5 54 2
5 45 3
5 33 4
5 12 5
5 1 6
much thanks for any clues. I can actually do this in VBA, but I'm gradually realizing how powerful and efficient SQL can be.
TQ, Terry W.