Table 1 has a result column that is type XML. I'll use square brackets instead of angle brackets because the HTML is easier.


Table 1
id result
1 [root]
[decision]foo[/decision]
[decision]bar[/decision]
[decision]baz[/decision]
[/root]
2 [root]
[decision]foo[/decision]
[decision]bar[/decision]
[decision]bang[/decision]
[/root]
3 [root]
[decision]foo[/decision]
[/root]

Table 2
id valid_decisions
1 foo
2 bar


I need to identify all the records from Table 1 that have any "decision" node that is not in Table 2 as a valid_decision. I believe I need to use the XQuery "nodes" function but can't get it working.

Any help?