59.1.7 Query Tutorial: Using the Join Set Command
At this stage we should mention the Join Set command. This command, as discussed earlier, allows you to create a Set of records based on a related Set of records. This is like doing a cross relational query followed by some Set commands all in one go. Thus for the above examples we could also have written:
Note that the results are exactly the same - as they should be!
Either method will create the same result with some important differences -
a You will usually find the Join Set method returns results MUCH faster.
b We find that using the Join Set method is also much more intuitive.
c Using the Join Set method is easier to read later when checking the Query.
d The Join Set method is guaranteed to never cause problems when there are circular relationships - these are relations where you can follow the flow in a circular pattern. For instance in STATIC, moving from [Location] to [HospitalRecord] to [ICURecord] back to [Location]. We have seen the use of a Cross Relational Query fail under some circumstances when there are too many Steps from the Master Table to the Field Table. In the case of STATIC this does not appear to be a problem at the moment BUT we will be adding more Tables to the program and so it may become a problem later on. Our advice, avoid cross relational Queries, use Join Set instead.
|