in the objektos table, assigned to each user_id entry, that is, who added this entry. I need that near each user the number of records is displayed on user_id, that is, how many each added records.

There is such a code, but it does not work, all the results are lost with the rest of the values ​​where I display

select u.* , (select count(*) from objektos o GROUP BY user_id) as entry_count from users u order by u.id desc 

    1 answer 1

     select u.* , ifnull(c.cnt, 0) as entry_count from users u left join (select count(*) as cnt, o.user_id from objektos o GROUP BY user_id) as c ON u.id = c.user_id order by u.id desc