I want to skip 'N' rows when I pull data. Using raw SQL I can accomplish this usingWHERE 'id' %%%u=0
where 'u' is my interval. Can I accomplish this using the Criteria object? I've tried this: $c->getNewCriterion(GaugeDataPeer::ID%$interval, 0, Criteria::EQUAL);
but to no avail.
This is on Symfony 1.4. Not sure what Propel version.
Here's the full query I'm trying to recreate:
$query = sprintf("SELECT *
FROM `processed_gauge_data`
WHERE `id` %%%u=0 AND `processed_gauge_data`.`gauge_id` IN (%s) AND `processed_gauge_data`.`stamp` >= '%s' AND `processed_gauge_data`.`stamp` <= '%s';",
$interval,
implode(',', $gauge),
mysql_real_escape_string(date('Y-m-d H:i:s', $start)),
mysql_real_escape_string(date('Y-m-d H:i:s', $end))
);
Just use ->where
->where('ProcessedGaugeData.Id %%%u = 0')
and better use ActiveQuery: http://propelorm.org/blog/2010/08/03/refactoring-to-propel-1-5-from-peer-classes-to-query-classes.html