Solved

SQL Query to pull two fields from two different tables

Posted on 2014-02-06
1
231 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows mapped drive communications - Secure? 5 47
MySql Recovery 2 28
Combining Queries 7 28
Restoring to Windows 7 on a Windows 10 machine 22 47
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
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.

830 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