php - Add count to SQL query -
i have following sql query , php output being run on mysql database...
$count0 = $wpdb->get_results(" select * wp_rg_lead inner join wp_rg_lead_detail on wp_rg_lead.id=wp_rg_lead_detail.lead_id wp_rg_lead.form_id = '46' , cast(date_created date) >= current_date - interval '7' day , field_number = '18' order value "); foreach ( $count0 $page ) { echo $repid_field . ' - ' . $page->form_id . ' - ' . $page->value . ' - ' . $page->lead_id . ' - ' . $page->date_created.'<br/>'; }
this works great want add count when outputs line tells me how many of 'value' exists.
i have had @ count function not sure add in
$count0 = $wpdb->get_results(" select *, count(*) totalvaluecount wp_rg_lead inner join wp_rg_lead_detail on wp_rg_lead.id=wp_rg_lead_detail.lead_id wp_rg_lead.form_id = '46' , cast(date_created date) >= current_date - interval '7' day , field_number = '18' order value ");
Comments
Post a Comment