I might be missing something easy, but here goes.
Consider the following code:
snipped from byItem.php
         $this->src('lookup2')
        ->query("
            select count(*) as count, sum(products_price) as sum, expired_medication, expired_medication_name, expired_index              from `iems_expired`.`tracerplus-expired-2020` expired
                    join `iems_expired`.`expired-reference` reference
                    on `expired`.`expired_medication`=`reference`.`expired_barcode`
                    join `iems_external`.`products` products
                    on reference.`expired_index` = `products`.`products_model`
                    group by expired_index
        ")
        ->pipe(new Group(array(
            "by"=>"expired_index",
            "sum"=>"sum(products_price)",
            "count"=>"count")))
        ->pipe(new Sort(array("count"=>"desc")))
        ->pipe(new Limit(array(600)))
        ->pipe($this->dataStore('lookup2'));
<?php
Table::create(array(
    "dataStore"=>$this->dataStore('lookup2'),
    "columns"=>array(
        "expired_medication_name"=>array("label"=>"Expired Medication"),
        "expired_index"=>array("label"=>"Barcode Number"),
        "sum"=>array("label"=>"Total Dollars"),
        "count"=>array("label"=>"Count"),
    ),
    "cssClass"=>array(
        "table"=>"table table-striped table-bordered"
    )
));
?>
This shows a table with the proper dollar amount but a value of 1 for count. I have ran the query in MySQL and it comes out correctly. What am I missing?
Jeremiah