Solved

SQL Join two tables or views problem

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

932 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

11 Experts available now in Live!

Get 1:1 Help Now