Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 1.45 KB | None | 0 0
  1. (SELECT TOP 1 LogisticsElectronicAddress.Locator
  2.     FROM [AX12].[AX2012R3_PROD].[DBO].LogisticsElectronicAddress
  3.     JOIN [AX12].[AX2012R3_PROD].[DBO].DirPartyLocation
  4.     ON LogisticsElectronicAddress.Location                                      = DirPartyLocation.Location
  5.     AND DirPartyLocation.Party                                                  = ContactPerson.Party
  6.     WHERE LogisticsElectronicAddress.Type                                       = 2 --Email
  7.     ORDER BY LogisticsElectronicAddress.IsPrimary                               DESC
  8. ) as                                                                            [EmailAddress], -- NOT MANDATORY, CAN BE NULL
  9. ISNULL(
  10.         (SELECT TOP 1 LogisticsElectronicAddress.Locator
  11.          FROM [AX12].[AX2012R3_PROD].[DBO].[LogisticsElectronicAddress]        
  12.          JOIN [AX12].[AX2012R3_PROD].[DBO].[DirPartyLocation]
  13.          ON [LogisticsElectronicAddress].Location                               = [DirPartyLocation].Location
  14.          AND [DirPartyLocation].Party                                           = ContactPerson.Party
  15.          WHERE [LogisticsElectronicAddress].IsMobilePhone                       = 1
  16.          AND [LogisticsElectronicAddress].Type                                  = 100 --lukSMS
  17.         ),
  18.         (SELECT TOP 1 LogisticsElectronicAddress.Locator
  19.          FROM [AX12].[AX2012R3_PROD].[DBO].[LogisticsElectronicAddress]
  20.          JOIN [AX12].[AX2012R3_PROD].[DBO].[DirPartyLocation]
  21.          ON [LogisticsElectronicAddress].Location                               = [DirPartyLocation].Location
  22.          AND [DirPartyLocation].Party                                           = ContactPerson.Party
  23.          WHERE [LogisticsElectronicAddress].IsMobilePhone                       = 1
  24.          AND [LogisticsElectronicAddress].Type                                  = 1 --Phone
  25.         )
  26.       ) as                                                                      [MobilePhone],
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement