MSExam 70-448 Part 2: Chapter 1 query wrong

Page 52 of the self paced training kit asks you to use the following query:

select convert(nvarchar(15),SC.AccountNumber) as CustomerAlternateKey, 
C.Title, C.FirstName, C.MiddleName, C.LastName, C.Suffix, 
C.EmailAddress, C.AddressLine1, C.AddressLine2, D.BirthDate, 
D.MaritalStatus, D.YearlyIncome, D.DateFirstPurchase, D.Gender, 
D.TotalChildren, D.NumberChildrenAtHome, D.Education, 
D.Occupation, D.HomeOwnerFlag, D.NumberCarsOwned 
from Sales.vIndividualCustomer C inner join Sales.Customer SC 
on C.BusinessEntityID = SC.PersonID 
inner join Sales.vIndividualDemographics D 
on C.BusinessEntityID = D.BusinessEntityID

It didn’t work for me , however this did (BusinessEntityID column replaced with CustomerID in the joins):

select convert(nvarchar(15),SC.AccountNumber) as CustomerAlternateKey, 
C.Title, C.FirstName, C.MiddleName, C.LastName, C.Suffix, 
C.EmailAddress, C.AddressLine1, C.AddressLine2, D.BirthDate, 
D.MaritalStatus, D.YearlyIncome, D.DateFirstPurchase, D.Gender, 
D.TotalChildren, D.NumberChildrenAtHome, D.Education, 
D.Occupation, D.HomeOwnerFlag, D.NumberCarsOwned 
from Sales.vIndividualCustomer C inner join Sales.Customer SC 
on C.CustomerID = SC.CustomerID 
inner join Sales.vIndividualDemographics D 
on C.CustomerID = D.CustomerID
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s