Advertisement
Luta036

Untitled

Jun 18th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.96 KB | None | 0 0
  1. INSERT INTO Klijenti(Ime,Prezime,Drzava,Grad,Email,Telefon)
  2. SELECT P.FirstName, P.LastName, PCR.Name, PA.City, P.firstname+'.'+P.lastname+RIGHT(PEA.EmailAddress, 20),PPP.PhoneNumber
  3. FROM [AdventureWorks2012].[Person].[Person] AS P INNER JOIN [AdventureWorks2012].[Person].[BusinessEntityAddress] AS PBEA
  4. ON P.BusinessEntityID=PBEA.BusinessEntityID
  5. INNER JOIN [AdventureWorks2012].[Person].[Address] AS PA
  6. ON PBEA.AddressID=PA.AddressID
  7. INNER JOIN [AdventureWorks2012].[Person].[StateProvince] AS PSP
  8. ON PA.StateProvinceID=PSP.StateProvinceID
  9. INNER JOIN [AdventureWorks2012].[Person].[CountryRegion] AS PCR
  10. ON PSP.CountryRegionCode=PCR.CountryRegionCode
  11. INNER JOIN [AdventureWorks2012].[Person].[EmailAddress] AS PEA
  12. ON P.BusinessEntityID=PEA.BusinessEntityID
  13. INNER JOIN [AdventureWorks2012].[Person].[PersonPhone] AS PPP
  14. ON P.BusinessEntityID=PPP.BusinessEntityID
  15. INNER JOIN [AdventureWorks2012].[Sales].[SalesPerson] AS SSP
  16. ON P.BusinessEntityID=SSP.BusinessEntityID
  17. GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement