question

DIPAK.THESIYA avatar image
DIPAK.THESIYA asked

TSQL Query : hierarchical compare

I have two tables Call it TableA and TableB. Below is the Sample Data. ![alt text][1] **Basically i want to hierarchical compare.** Now from TableB for every row I need to find matching row from TableA using below logic. 1. First match by UniqueId. 2. If not matched by UniqueId then match by UniqueId2 3. If not found a match from above 2 fields then match by ComapnyId 4. Final matching field if none of above matched then use SectorId 5. Id none of the matching row found then drop the row. [1]: /storage/temp/4625-query.jpg
tsqlhierarchical-query
query.jpg (140.0 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.