Solved

SQL Query to pull two fields from two different tables

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Creating and Managing Databases with phpMyAdmin in cPanel.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

785 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