Solved

SQL Query to pull two fields from two different tables

Posted on 2014-02-06
1
238 Views
Last Modified: 2014-02-06
I'm trying to do the following using a select to find all addrnames that do not have a zipcode. Addrname and zipcode live in two different tables.

----pseudo code

SELECT DISTINCT Addrname
from tableA

where tableB.zipcode is NULL
0
Comment
Question by:bjbrown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
Brian Pringle earned 500 total points
ID: 39839568
You would need to select data from tableA, tableB and form some sort of relationship.  Can you provide information about the column names in each table?  What is the name of the column in each table that forms the relationship?

It would be something like...

select tableA.Addrname
from tableA, tableB
where tableA.somecolumn = tableB.somecolumn
and tableB.zipcode is NULL
                     (or maybe just tableB.zipcode = "")
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.

623 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