There is such a request

select `works`.*, count(`like`.`wid`) as likes from `works`, `like` where `works`.`id` = `like`.`wid` group by id 

and accordingly, I get data where `works`.`id` = `like`.`wid` , and how can I make it so that if there’s no table in the table like where where `works`.`id` = `like`.`wid` that count(`like`.`wid`) as likes would be 0

    1 answer 1

    Just use left join .

     select `works`.*, count(`like`.`wid`) as likes from `works` left join `like` on `works`.`id` = `like`.`wid` group by id