SQL Learning Center - GoldMine

Use SQL queries to get answers from GoldMine

June 6, 2008

Contacts in 1st GoldMine Group But Not in 2nd GoldMine Group

by @ 4:11 pm. Filed under MSSQL Groups

Type: MSSQL
Description: This query returns the accountnos (which can then be used to create a third group) of contacts who are in a 1st GoldMine Group but not in a 2nd GoldMine Group.

  1.  
  2.        
  3. SELECT
  4.   accountno
  5. FROM
  6.  (SELECT
  7.    c1.accountno
  8.   FROM
  9.    contact1 c1
  10.   JOIN contgrps cg
  11.   ON c1.accountno=cg.accountno
  12.    JOIN contgrps cg1
  13.    ON cg.userid = cg1.recid
  14.   WHERE
  15.    LEFT(cg1.Accountno,2) = '*M'
  16.    AND (     cg1.REF = '1st GoldMine Group Name')) InGroup
  17.    WHERE  InGroup.accountno
  18.    NOT IN
  19.    (SELECT
  20.      c1.accountno
  21.     FROM
  22.      contact1 c1
  23.     JOIN contgrps cg
  24.      ON c1.accountno=cg.accountno
  25.      JOIN contgrps cg1
  26.        ON cg.userid = cg1.recid
  27.      WHERE
  28.       LEFT(cg1.Accountno,2) = '*M'
  29.       AND (cg1.REF = '2nd GoldMine Group Name'))
  30.  

GoldMine SQL Tutorial:

General SQL Tutorials:

SQL Help Links:

Recommended Reading - SQL Books:

RSS:

Links:

Search For SQL Query:

GoldMine MS SQL Queries:

GoldMine dBase SQL Queries (LocalSQL):

21 queries. 0.075 seconds