I am trying to php code a sql script that retrieves the last 7 days of data. I have two dates, $startDate and $endDate like ths:
Code: Select all
$startDate=date('Y-M-D', strtotime('-1 week'));
$endDate=date('Y-M-D', strtotime('-1 day'));
Code: Select all
$query = "select account as account,
campaign as campaign,
sum(impressions)impressions,sum(clicks)clicks,sum(cost)cost,avg(avg_position),sum(conv_mpc)conversions
From ppc_data
where date between '".$startDate."' and '".$endDate."'
group by campaign
order by conversions desc;
";
Thanks
Peter