How to create mysql NOT EXISTS statement ?

Shamsul Kamal
Shamsul Kamal used Ask the Experts™
on
Hi,

I would like to request an assistant.

I have the following mysql table and column :

Table clientid
==========
column 1 : no
column 2 : name
column 3 : domain

Table list
==========
column 1 : no
column 2 : status
column 3 : domain


May i know how to do mysql query to list the domain that is not exist in the other column "domain" above ?

eg of data :

clientid.domain
============
abc1.com
abc2.com
abc3.com

list.domain
=========
xyz1.com
xyz2.com
abc1.com


Appreciates any assistant.


Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Billing Engineer
Most Valuable Expert 2014
Top Expert 2009
Commented:
you mean:
select table1.domain
  from table1
where not exists ( select null from table2 where table2.domain = table1.domain )

Open in new window

Commented:
If you are trying to list the entries in clientid.domain that do not in exist in list.domain:
Select *
From clientid.domain
Where domain Not In
(Select domain From list.domain)

If you are trying to list the entries in list.domain that do not in exist in clientid.domain:
Select *
From list.domain
Where domain Not In
(Select domain From clientid.domain)
Ahmed MerghaniSoftware Engineer

Commented:
Can you give the expected result from your eg .data ?

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial