php
getting count of the same price grouping by the same transaction id
I'm trying to get the count of all prices with the same transaction type id , but i'm getting error with that , don't know the reason . here's my code : $Query =TableRegistry::get('Transactions')->find()->select('Transactions.price','Transactions.transactions_type_id') ->contain('TransactionsTypes'); $Query->select([ 'Transactions.price' , 'count' => $Query->func()->count('*') ]) ->group('Transactions.transactions_type_id'); and if i'm going to print it , getting me that error : 100 \plugins\Budgets\src\Controller\PagesController.php (line 143) object(Cake\ORM\Query) { '(help)' => 'This is a Query object, to get the results execute or iterate it.', 'sql' => 'SELECT Transactions.price AS `Transactions__price`, (COUNT(*)) AS `count` FROM transactions Transactions LEFT JOIN transactions_types TransactionsTypes ON TransactionsTypes.id = (Transactions.transactions_type_id) GROUP BY Transactions.transactions_type_id ', 'params' => [], 'defaultTypes' => [ 'Transactions__id' => 'integer', 'Transactions.id' => 'integer', 'id' => 'integer', 'Transactions__transactions_type_id' => 'integer', 'Transactions.transactions_type_id' => 'integer', 'transactions_type_id' => 'integer', 'Transactions__financial_year_id' => 'integer', 'Transactions.financial_year_id' => 'integer', Which 100 is the value of the first only column of the price with the same transaction type ! So how to get the count of all prices with the same transaction type id ? Thank you
Related Links
Symfony 2: Multiple forms generated list of objects
facebook api file upload getting 324 error
MySQL fetch array not collecting and returning all the rows | PHP | MySQL
mysql table bind next row and current row
How can I check my ip address?
PDO debugging update query using bindValue
PHP Errors after Migrating Wordpress Site
How to Access to Laravel 5 with Pingpong-Modules to a specific Module
Slow queries with PHP application but not with phpMyadmin
How can I define global variables inside a twig template file?
JSONObject text search to Mysql
php codeigniter count rows
How to pass extra parameters on extension's class from main config?
Eloquent relationship. Changed table name
Model not updated due to validation error
Enable Errors in Openshift PHP