I'm trying to find the count of the number of devices that are greater than the amount from a certain data source.
last_data_source = LocalDeviceSummary.find(:first, :order => 'created_at desc')
count = RemoteDeviceSummary.count ["DeviceSummaryIndex > ?", last_data_source.data_source_id]
The last_data_source works fine, I tested that. The error is with the count. Here is the error.
Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?2896012) AS count_devicesummaryindex_2896012 FROM device_summary
' at line 1: SELECT count(DeviceSummaryIndex > ?2896012) AS count_devicesummaryindex_2896012 FROM device_summary