• Thanks much, I created the table script in the attachement. there are two tables, one is masterAddress table - is used for verifying address, the other is studentaddress table.

    Now I think I should use function but use direct join: that is the second attachment.

    I would like to join students table with master address table to get addressID, the problem is student table they don't have house modifier but master address does and some are have multiple hosue modifier, so when join with masteraddress table it will get duplicates, that is why they use those orders,

    the goal is to get the first record returned by those columns ordered.

    Thanks so much for taking look into this.