1

I have two tables master_domain_list and temporary_domain_list. master_domain_list contains a list with columns for the email ID and domain name. temporary_domain_list also contains the domain column.

I want to filter temporary_domain_list to show all domain names which are not present in master_domain_list.

I tried the following code (inner join inverse) but it's giving the whole list of domains from temporary_domain_list without removing the domains in master_domain_list.

$result1=mysqli_query($cons, "
      SELECT domain 
      FROM temporary_domain_list 
      WHERE domain NOT IN  (SELECT domain 
      FROM master_domain_list)
      ");
Matt Raines
  • 4,149
  • 8
  • 31
  • 34
sanjay
  • 1
  • 5
  • 2
    Your query seems to be fine, what's your problem? Want to do it with `INNER JOIN`? – Blank Jul 13 '16 at 06:16
  • This query is giving the whole list of domains from email_temporary without filtering or comparing with email_master. – sanjay Jul 13 '16 at 06:18
  • Actually this query does *filtering or comparing*, I think. You used `NOT IN`, which means it will give you domains in `temporary_domain_list` and not in `master_domain_list`, isn't it? – Blank Jul 13 '16 at 06:21
  • Yes , but this query is returning whole domain list present in temporary_domain_list which is already present in master_domain_list. – sanjay Jul 13 '16 at 06:28
  • Just a minor .. in your post you name the table email_master and email_temprary .. nut in code .. you name temprary_domain_list and mater_domain_list ... hope this is not the problem – ScaisEdge Jul 13 '16 at 06:28
  • The table name is: (a) master_domain_list and (b) temporary_domain_list – sanjay Jul 13 '16 at 06:31
  • 1
    Your query works fine for me with two simple sample tables. You'll have to provide more detail such as a `CREATE TABLE` syntax for both tables and some sample data which doesn't work. Is it possible some of the domains contain leading spaces or are in some other way not identical? – Matt Raines Jul 13 '16 at 06:51

0 Answers0