I have a database with 2 tables that I am working with (SugarCRM).
I am querying the table cases_audit to get a row count of cases with a status changed to closed. All this works great.
What I am having trouble with is figuring out how to take the id from cases_audit and ensure that under table cases that same id has a type = “support”
// Query cases_aduit to find out how many cases were closed -0 days ago
$query_date_1_closed = "select * from cases_audit where after_value_string = 'Closed' and date_created LIKE '$date_1 %'";
$rs_date_1_closed = mysql_query($query_date_1_closed);
$num_rows_1_closed = mysql_num_rows($rs_date_1_closed);
Assuming the column
idincases_auditreferes toidincases(which is not very likely), this query gives you every column from the audit plustypefrom the appropriate case:If you want to count the closed support cases, add
C.typeto your WHEREcondition: