Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2009

    Unanswered: Show ContactID's without Activity

    Hi All,

    I have two tables, one called "contacts" and the other "activities"
    for simplicities sake "contacts" looks like this:

    ContactID / AccountID / FirstName / LastName

    activities looks like:

    ContactID / AccountID / Subject / Date

    What I am trying to do is show a "non-activity" list.
    So say I have 3 users with ContactID's ABC, 123, XYZ

    Users ABC and 123 have an activity in January 2013.

    So when i run the non-activity list for January 2013 only one user should be show: ContactID XYZ.

    I have trie dthis:

    select contacts.contactid from contacts, activities where activities.contactid <> contacts.contactid 
    and completeddate like '2013-01%' 
    and contacts.accountid = 'AAXA-2313D6' 
    and activities.accountid = 'AAXA-2313D6';
    I thought that by specifying the date would have excluded those that do not appear in January 2013.
    But the result just shows me all the ContactIDs regardless if they have had an activity or not.

    Any pointers?


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    you should be using a join to define the relationship between the two tables
    use a left join to retrieve ALL required columns in contacts

    if you then say you only want rows (contact ID's with a null activity date
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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