Hello,
I need to get all cost_micros for a certain period. In the query below, I get all the data for the period I specified, but there is one problem. In the event that there were no clicks on a certain day, i.e. nothing was spent, I need to get 0. That is, if the period spans 20 days, then I want to get 20 values, some of which may be equal to 0. Now, in this case, I get, for example, 18 values for 20 days, and then I can't match dates and expenses. I don't want to make separate queries for each date as some periods can span 5-7 years.
$query = "SELECT
campaign.name, campaign.start_date, campaign.end_date, metrics.cost_micros, segments.date FROM campaign
WHERE segments.date >= " . "'" . $startDate . "'" . "
AND segments.date <= " . "'" . $endDate . "'" . "
AND
campaign.id IN (".implode(', ',$campaignIds).") ORDER BY
campaign.id";