Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Show ContactID's without Activity

$
0
0
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:

Code:

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?

Thanks

Viewing all articles
Browse latest Browse all 13329

Trending Articles