Page 1 of 1

SQL Query assistance

PostPosted: Mon Feb 11, 2008 11:54 am
by enjay
Im looking for a query syntax to extract records (based on lead_id) from the vicidial_list table and the vicidial_log table that match a set of specific "statuses" "statuses that ultimately mean will not be dialed again such as disconnected, or business etc". I was trying to use modify_date in the vicidial_log table as an identifier however that date changes when the list is reset.

all I need is the "lastcalled" date, without there being 4-5 of the same phone number records..

hope this makes sense.. any assistance would be great..

PostPosted: Mon Feb 11, 2008 1:29 pm
by heinz
HI

how about:

Code: Select all
SELECT * from vicidial_list
INNER JOIN vicidial_log
ON vicidial_list.lead_id = vicidial_log.lead_id
WHERE vicidial_list.status=vicidial_log.status
AND vicidial_list.user = vicidial_log.user
AND vicidial_list.status ='$status'
AND vicidial_log.call_date BETWEEN '$datestart' AND '$dateend';


Cheers,
heinz