I have a table Data as below:
Name Address Country
A PO 123 AF Afghanistan
B PO 23 AFG AF
C PO IND df1 AFG
D PO 12345 USA
I would like to get all records which has Address different from Country. In above example, I need record 3 (Name = C) as Address has "IND" and Country is "AFG".
Note:
Countrycan be ISO-2, ISO-3 or Description (Ex. "IN", "IND" or "India")Addressmay or may not contain country name - if it contains, it could be ISO-2, ISO-3 or Description.Countrydetail is stored in a separate Country table and has all countries stored as -Id | Iso2 | Iso3 | Description
I am sure,
- First, we will need to check if Address contains ISO-2, ISO-3 or Description of any country - Address is a free text and country can be anywhere in the text or country may not even be present in Address - in such case, we need to skip those records.
- Then, if Address has country detail, we need to check if it is different from Country column (which again may contain ISO-2, ISO-3 or Description)
Thanks in advance for any help.