aggregate_field_statement (DataMapper::Aggregates::DataObjectsAdapter::SQL)

    # File lib/dm-aggregates/adapters/data_objects_adapter.rb, line 89
            def aggregate_field_statement(aggregate_function, property, qualify)
              column_name = if aggregate_function == :count && property == :all
                '*'
              else
                property_to_column_name(property, qualify)
              end

              function_name = case aggregate_function
                when :count then 'COUNT'
                when :min   then 'MIN'
                when :max   then 'MAX'
                when :avg   then 'AVG'
                when :sum   then 'SUM'
                else raise "Invalid aggregate function: #{aggregate_function.inspect}"
              end

              "#{function_name}(#{column_name})"
            end