Solved

SQL Query to pull two fields from two different tables

Posted on 2014-02-06
1
215 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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

763 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

10 Experts available now in Live!

Get 1:1 Help Now