Click here to Skip to main content
15,901,283 members
Home / Discussions / Database
   

Database

 
AnswerRe: select before and after question Pin
Chris Meech13-Mar-10 9:10
Chris Meech13-Mar-10 9:10 
GeneralRe: select before and after question Pin
Eli Nurman13-Mar-10 9:24
Eli Nurman13-Mar-10 9:24 
GeneralRe: select before and after question Pin
Jörgen Andersson13-Mar-10 10:04
professionalJörgen Andersson13-Mar-10 10:04 
GeneralRe: select before and after question Pin
Eli Nurman13-Mar-10 10:46
Eli Nurman13-Mar-10 10:46 
GeneralRe: select before and after question Pin
Not Active13-Mar-10 11:46
mentorNot Active13-Mar-10 11:46 
GeneralRe: select before and after question Pin
Eli Nurman13-Mar-10 12:09
Eli Nurman13-Mar-10 12:09 
GeneralRe: select before and after question Pin
Mycroft Holmes13-Mar-10 20:27
professionalMycroft Holmes13-Mar-10 20:27 
Questionneed help in building this view, please Edited to add results of trying RIGHT OUTER JOIN Pin
Michael J. Eber12-Mar-10 10:39
Michael J. Eber12-Mar-10 10:39 
I have three primary tables:
CustomerMaster
ContactMaster
AddressList

Each customer master has a one to many relationship with contacts.
Each contact has a possible 1:1 relationship with the AddressList. (ie. null addresses ok)
Each address in the AddressList has a 1:1 relationship with CityEnumerators and StateEnumerators.

I'm trying to get a view working that shows all contacts that are active whose CustomerMaster record is active. Unfortunately I only get the contacts that have addresses and not the ones without addresses. I thought the following query would do it....but no go. (BTW also tried RIGHT OUTER JOIN with no luck also)

Any help would be appreciated as to what I'm doing that is screwing the pooch.

SELECT     TOP (100) PERCENT dbo.CustomerMaster.BSACustomerKey, dbo.ContactMaster.ContactName, dbo.ContactMaster.BusinessPhone, dbo.ContactMaster.MobilePhone, 
                      dbo.ContactMaster.Email, dbo.ContactMaster.FirstName, dbo.ContactMaster.LastName, dbo.ContactMaster.EmergencyMaintenance, 
                      dbo.ContactMaster.NormalMaintenance, dbo.ContactMaster.NetworkAbuse, dbo.ContactMaster.IssuedSwipeCard, dbo.ContactMaster.CardNumber, 
                      dbo.AddressList.CustomerAddressLine1, dbo.AddressList.CustomerAddressLine2, dbo.AddressList.CustomerAddressLine3, dbo.AddressList.CustomerPostBox, 
                      dbo.CityEnumerator.City, dbo.StateEnumerator.State, dbo.AddressList.CustomerCounty, dbo.AddressList.CustomerCountry, dbo.AddressList.CustomerZipcode, 
                      dbo.ContactMaster.BmcCustKey
FROM         dbo.ContactMaster INNER JOIN
                      dbo.CustomerMaster ON dbo.ContactMaster.CompanyID = dbo.CustomerMaster.CustomerIdentity LEFT OUTER JOIN
                      dbo.AddressList ON dbo.ContactMaster.ContactAddress = dbo.AddressList.AddressIdentity INNER JOIN
                      dbo.CityEnumerator ON dbo.AddressList.CustomerCity = dbo.CityEnumerator.CityIdentity INNER JOIN
                      dbo.StateEnumerator ON dbo.AddressList.CustomerStateorProvince = dbo.StateEnumerator.StateIdentity
WHERE     (dbo.CustomerMaster.CustomerStatus = 1) AND (dbo.ContactMaster.Status = 1)
ORDER BY dbo.CustomerMaster.BSACustomerKey

AnswerRe: need help in building this view, please Edited to add results of trying RIGHT OUTER JOIN Pin
Mycroft Holmes12-Mar-10 16:52
professionalMycroft Holmes12-Mar-10 16:52 
GeneralRe: need help in building this view, please Edited to add results of trying RIGHT OUTER JOIN Pin
Michael J. Eber15-Mar-10 7:47
Michael J. Eber15-Mar-10 7:47 
GeneralRe: need help in building this view, please Edited to add results of trying RIGHT OUTER JOIN Pin
i.j.russell15-Mar-10 9:31
i.j.russell15-Mar-10 9:31 
QuestionGetting SP results from a table with multiple rows for same ID [modified] Pin
DeepToot12-Mar-10 9:37
DeepToot12-Mar-10 9:37 
AnswerRe: Getting SP results from a table with multiple rows for same ID Pin
Luc Pattyn12-Mar-10 10:06
sitebuilderLuc Pattyn12-Mar-10 10:06 
GeneralRe: Getting SP results from a table with multiple rows for same ID Pin
DeepToot12-Mar-10 10:15
DeepToot12-Mar-10 10:15 
AnswerRe: Getting SP results from a table with multiple rows for same ID Pin
riced12-Mar-10 13:49
riced12-Mar-10 13:49 
GeneralRe: Getting SP results from a table with multiple rows for same ID Pin
DeepToot15-Mar-10 5:06
DeepToot15-Mar-10 5:06 
Questionhelp me understanding left join Pin
Mogamboo_Khush_Hua11-Mar-10 19:28
Mogamboo_Khush_Hua11-Mar-10 19:28 
AnswerRe: help me understanding left join Pin
Rod Kemp11-Mar-10 22:39
Rod Kemp11-Mar-10 22:39 
AnswerRe: help me understanding left join Pin
Mycroft Holmes11-Mar-10 23:15
professionalMycroft Holmes11-Mar-10 23:15 
GeneralRe: help me understanding left join Pin
Mogamboo_Khush_Hua12-Mar-10 2:16
Mogamboo_Khush_Hua12-Mar-10 2:16 
QuestionAccess 2007 - tabbed forms manage own popups Pin
john john mackey11-Mar-10 5:33
john john mackey11-Mar-10 5:33 
AnswerRe: Access 2007 - tabbed forms manage own popups Pin
Eddy Vluggen12-Mar-10 2:23
professionalEddy Vluggen12-Mar-10 2:23 
GeneralRe: Access 2007 - tabbed forms manage own popups Pin
john john mackey16-Mar-10 7:37
john john mackey16-Mar-10 7:37 
Questionproject Pin
salemmohamed10-Mar-10 22:54
salemmohamed10-Mar-10 22:54 
AnswerRe: project Pin
Mycroft Holmes10-Mar-10 23:53
professionalMycroft Holmes10-Mar-10 23:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.