php - why does count function return one row? -


i have query using pdo

"select category.id id, category.static_name   static_name,   category.name name, count(training.id) trainings_count         category         join training   on training.cat_id = category.id" 

when columns empty, count function returns 1 row , whole function return true. solution problem ?

if don't group answers category, count returned , give 1 answer. way aggregate functions (count, sum, min, max, etc.) supposed function.

so question is, want count of. add clause group <blah> <blah> item wanting count items of.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -