simple (I hope) SQL question

Posted on 2014-11-04
Last Modified: 2014-11-06
just a simple question (I hope).
I've 2 tables (say table1 and table2) both have a common column (say "cf") but the first table has in this column more values than the second (aka the first table have more records than the second).
I'd like to extract all the data of the first table whose cf values (i.e. are NOT present on the second table (i.e. are NOT in

thanks a lot for your help,
Question by:fabianope65
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
LVL 26

Assisted Solution

by:Shaun Kline
Shaun Kline earned 167 total points
ID: 40422154
select *
from table1
where not exists (select 1 from table2 where cf =
LVL 58

Accepted Solution

Gary earned 166 total points
ID: 40422156
SELECT * FROM table1 WHERE cf NOT IN (SELECT cf FROM table2)

Open in new window

LVL 11

Assisted Solution

John_Vidmar earned 167 total points
ID: 40422835
FROM	table1	a
JOIN	table2	b	ON =

Open in new window


Author Closing Comment

ID: 40425684
Thanks to all of You,
See You,

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

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…
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

728 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