Quote Originally Posted by jindon View Post
If that's the case, it only needs to search what is in SITE PREFERENCES against SITE_TABLE and return the result(s)(corresponding value) and when it is blank, mark as "No match".

Is this correct? or am I still missing something?
Yes that is correct, it only needs to SITE PREFERENCES against the SITE _TABLE (excluding the SITE EXCLUSIONS AND STATE EXCLUSIONS)

If the preferences are Blank, then mark as "No Match"
If the State is missing beside a SITE_ID in the SITE_TABLE that was their preference it will also be "No Match" (Unless one of their other preferences can be matched)

For Example if:
USER ID = 31267
STATE/TERRITORY EXCLUSIONS = NSW and WA
SITE EXCLUSIONS = 1640 and 1670 (as well as all in NSW and WA)BLANK
SITE PREFERENCES = Preference 1 = 1640, Preference 2 = 1670, Preference 3 = 81, Preference 4 = 422, Preference 5 = BLANK

1640 is in WA so they can't work there
1670 is in NSW so they Can't work there
81 is in NSW so they can't work there
422 WAS in Blank for state, then it would look at preference 5 (if they had one)
In this example, if they had preference 5 = 1324 (Tas) they would have a match on preference 5

So in Column 'BM' it would say 1324