Solved

SQL Join two tables or views problem

Posted on 2013-01-02
3
411 Views
Last Modified: 2013-01-02
I'm having a problem that I didn't envision and need someone to help me out with this to see what I am doing wrong.

I have two views (People and Address).  The People view has a Household ID record that is NOT unique as it is referenced for each person that lives in a specific household based upon a certain criteria.  Address is a list of residential addresses where the HHID is unique to each record.

I am trying to combine the two tables into a view where each persons address is also shown.

I have tried a hhid = hhid, inner join and a right join (people to address) but each one is coming up with a problem that renders it unusable.  Please let me know if you have any suggestions.

Thanks,
0
Comment
Question by:gwarcher
3 Comments
 
LVL 8

Accepted Solution

by:
Barry62 earned 500 total points
ID: 38737955
Is this something like you have tried (I'll assume some field names here?):

select People.Name,Address,street,Address.city,Address.ST,Address.zip inner join Address on People.hhid = Address.hhid

Select statement and we will get it figured out.
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 38737959
0
 

Author Comment

by:gwarcher
ID: 38737967
There has to be something wrong with my UID fields as everything in the select statement appears correctly.  You are right though.  I will try a couple things and get back to you if I need additional help.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now