Answer the question
In order to leave comments, you need to log in
How to specify the value 0 instead of NULL?
Please help me with the request. I want to make a league table. The essence of the problem is that I need the total number of defeats of the team to be displayed in the views, and everything is displayed well, but ... If the team has no defeats, then this line simply does not appear, that is, as if the NULL value is attached. I need to display 0, not NULL.
select `vw_игры`.`id_команды` AS `id_команды`,count(`vw_игры`.`id_команды`) AS `поражения` from `test`.`vw_игры` where (`vw_игры`.`забили` < `vw_игры`.`пропустили`) group by `vw_игры`.`id_команды`
Answer the question
In order to leave comments, you need to log in
SELECT IFNULL(count(`vw_игры`.`id_команды`), 0) as `поражения`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question