I think it's a matter of taste... what would SQL do much different
internally?
if the data is organized like here, means you need only one way comparison,
you can do it with a single flag and without altering the structures themselves:
Code: Select all
Structure XUsed
Used$
EndStructure
Structure XAvail
Avail$
EndStructure
NewList XUsed.XUsed()
NewList XAvail.XAvail()
For x = 1 To 255
AddElement(XAvail())
XAvail()\Avail$ = Str(Random(3 * 23))
Next x
For y = 1 To 255
AddElement(XUsed())
XUsed()\Used$ = Str(y)
Next y
ForEach XUsed()
Flag = 0
ForEach XAvail()
If XUsed()\Used$ = XAvail()\Avail$
Flag = 1
EndIf
Next
If Flag = 0
Debug "Used:" + XUsed()\Used$ + " is Not in Avail"
EndIf
Next
you can check in
one double-ForEach, if elements of the list of the outer loop are present in the list of the inner loop.
but you can't check the opposite
additionally in the same double-Loop without implementing an elementwise flag.
... you sure can drive a second double-Loop with the lists exchanged right afterwards.
I didn't do that in yesterdays example to keep the number of iterations low.
... I would bet a single request in SQL would do just such a double loop with a temporary flag.
oh... and have a nice day.