Solved

SQL Join two tables or views problem

Posted on 2013-01-02
3
414 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

821 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