Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with a simple JOIN please

Status
Not open for further replies.

360degreehosting

IS-IT--Management
Oct 17, 2006
16
0
0
US
Hi,

I need help with a simple join. I'm not sure where I'm going wrong but help would be appreciated.

Table Structure::

Table1:
ZipCode


Table2:
ZipCode


Table 1 - sample data

ZipCode
_______
12345
12346
12347
12347
78943
78942


Table 2 - sample data

ZipCode
_______
12345
12346
12347
12348
12349

Results needed:
I need to end up with data from Table1 that includes:

12345
12346
12347
12347

This seems like a simple join but I am not able to accomplish this.

Thank you for an example query based on my explanation.

Warmest Regards,
Steve
 
What have you tried so far? Can you show us your query?

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
INNER
Code:
SELECT ZipCode
       FROM Table1
       INNER JOIN Table2 ON Table1.ZipCode = Table2.ZipCode

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Have you tried
Code:
SELECT ZipCode FROM Table1
   WHERE ZipCode IN (SELECT ZipCode FROM Table2)

djj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top