I have two tables. One is company and 2 is action. Everytime an employee calls or emails a client there is a new action in the action table. So basically I want to select all companies which have no action or no action associated with them for the last x amount of days. I now have a new action called Fax. I want to ignore those companies that have received a fax, and not include it in the action. So that if a company has not recieved any avtion it will be included in the recordset as well as a company who has recieved only a fax and not any other action. The following is my sql statement. How can I add that?
Basically I need to say either there is no action, or if there is than the atype is anything but fax.
Basically I need to say either there is no action, or if there is than the atype is anything but fax.
Code:
"SELECT c.company_id, c.com_name, c.Country_ID, Max(a.On_Date) As LastDate, c.com_rep" _
& " FROM company AS c LEFT JOIN actions AS a ON c.company_id = a.company_id" _
& " WHERE c.Country_ID Is Not Null and c.com_name is not null and c.cominfo_status = 'Active'" _
& " GROUP BY c.company_id, c.com_name, c.Country_ID, c.com_rep, a.company_id" _
& " HAVING (a.company_id Is Null Or Max(a.On_Date) < Date() - " & numDays & ")"