mysql - Database Query Issue with count of each row -


i have 2 tables following structure

details --------------- id | session_id 1    1 2    1 3    1  details_extra --------------- id | details_id 1    1 2    1 3    2 4    3 

output looking -

output --------------- id  | subscribers(count) 1     2 2     1 3     1 

the query writing -

select id, count(details_extra.id) details left join details_extra on details_id = details.id session_id='1'; 

output

{id:1, subscribers:4}  

can 1 please help.

edit - got working adding group by.

try group id:

select id, count(details_extra.id) details left join details_extra on details_id = details.id session_id='1' group id; 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -