I have 2 docs with information that may or may not be related. I need to get every record, but no duplicates (if they're related - they're treated as 1).
To illustrate:
<doc1>
<person>
<number>123</number>
<fname>Bob</fname>
</person>
<person>
<number>345</number>
<fname>Jane</fname>
</person>
</doc1>
<doc2>
<surname>
<num>234</num>
<lname>Smith</lname>
</surname>
<surname>
<num>123</num>
<lname>Jones</lname>
</surname>
</doc2>
I need to construct a Join query that will return every <num> - combining any data where <num>'s are the same.
Results of the query would be something like:
'123', 'Bob', 'Jones'
'234', '', 'Smith'
'345', 'Jane', ''
I know how to get all the first names OR all the last names... don't know how to get both.
Thanks>
One more thing... not sure if it'll matter - but it would also be helpful if I could Order By <num>.