Breaking news from around the world
Get the Bing + MSN extension
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2019 release wave 2 Discover the latest updates and new features to Dynamics 365 planned through March 2020
Release overview guides and videos Release Plan | View virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
When joining the tables UPR00100 and UPR00102, you have to consider if you want the employee information and all of their addresses or just the current address displayed on the Employee Maintenance window (Employee Card).
The most common query is to get just the address displayed on the employee card and to do that use the fields EMPLOYID and ADRSCODE from each table to join them together.
SELECT E.LASTNAME, E.FRSTNAME, A.ADRSCODE, A.ADDRESS1, A.ADDRESS2, A.CITY, A.STATE, A.ZIPCODEFROM UPR00100 AS E INNER JOIN UPR00102 as A on E.EMPLOYID = A.EMPLOYID and E.ADRSCODE = A.ADRSCODEWHERE E.EMPLOYID = 'BARR0001'
This query will return only one record. The Employee information and the address that is currently displayed on the Employee Card.
However, if you leave off the “and E.ADRSCODE = A.ADRSCODE” part of the inner join like this:
SELECT E.LASTNAME, E.FRSTNAME, A.ADRSCODE, A.ADDRESS1, A.ADDRESS2, A.CITY, A.STATE, A.ZIPCODEFROM UPR00100 AS E INNER JOIN UPR00102 as A on E.EMPLOYID = A.EMPLOYID WHERE E.EMPLOYID = 'BARR0001'
In the initial demo company you will actually get two records, one for the primary address (ADRSCODE = ‘PRIMARY’) and one for the work address (ADRSCODE = “WORK”)
Now while initially you may think you would never want to do that, what if you are actually creating a warehouse table and wanted both addresses in the same record in the warehouse table. Then you could do something like this.
SELECT E.LASTNAME, E.FRSTNAME, PA.ADDRESS1 as PRIMARY_ADDRESS1, PA.ADDRESS2 as PRIMARY_ADDRESS2, PA.CITY as PRIMARY_CITY, PA.STATE as PRIMARY_STATE, PA.ZIPCODE as PRIMARY_ZIPCODE, WA.ADDRESS1 as WORK_ADDRESS1, WA.ADDRESS2 as WORK_ADDRESS2, WA.CITY as WORK_CITY, WA.STATE as WORK_STATE, WA.ZIPCODE as WORK_ZIPCODEFROM UPR00100 AS E INNER JOIN UPR00102 as PA on E.EMPLOYID = PA.EMPLOYID and PA.ADRSCODE = 'PRIMARY' INNER JOIN UPR00102 as WA on E.EMPLOYID = WA.EMPLOYID and WA.ADRSCODE = 'WORK'WHERE E.EMPLOYID = 'BARR0001'
However, notice in this “warehouse” query:
So, depending on your exact needs you can now join the two tables either way you wish.
Table of Contents
Business Applications communities