Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图在互联网上找到如何在 PHP 中使用 SQL 命令中的 IF,但我可以找到一个很好的教程。
所以我想做
SELECT *,(neutral_kills*0.5 + rival_kills)/deaths AS totalkdr FROM sc_players ORDER BY totalkdr DESC LIMIT 0,10
但我想放IF (deaths == 0){deaths + 1}
IF (deaths == 0){deaths + 1}
我该怎么做?
IF像函数一样使用:
IF
SELECT *,(neutral_kills*0.5 + rival_kills)/IF(deaths = 0, 1, deaths) AS totalkdr FROM sc_players ORDER BY totalkdr DESC LIMIT 0,10