sql join

Results 1 to 2 of 2

Thread: sql join

  1. #1
    Join Date
    Dec 1969

    Default sql join

    I have 2 tables <BR>table1 = 18000 records<BR>table2 = 2500 records<BR><BR>table2 contains records which may already contain in table1 <BR>i want to filter those records and get a result of all unique records from both the table. I am using this query <BR><BR>SELECT DISTINCT u.email, mu.email <BR>FROM users u <BR>LEFT OUTER JOIN newsletterusers mu <BR>ON u.email != mu.email <BR><BR>but this query takes forever so i dont know if its going to retrieve the correct records. the actual records received should be around 16500 which i have worked out manually.<BR><BR>brij <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: sql join

    Use a subquery, something like:<BR><BR>SELECT DISTINCT email FROM users WHERE <BR>email IN <BR>(<BR>SELECT email FROM newsletterusers<BR>)<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts