How can I do in% with a mysql
(SELECT) so that when the value is equal to query
, replace it with 0
.
Value field: int.
How can I do in% with a mysql
(SELECT) so that when the value is equal to query
, replace it with 0
.
Value field: int.
@Eduardo Santos,
If you want to change the 0 by the hyphen in a select you do this:
SELECT IF(seu_campo = 0, '-', seu_campo) AS nome_para_esse_resultado FROM sua_tabela;
You can use a IF
in the query .
The IF
receives three "parameters", the first is the condition, the second is the value that the column will assume if the condition is met and the third is the value that the column will assume otherwise. >
Select If(Campo = 0, '-', Campo) From Tabela
Select IIF(Campo = 0, '-', campo) AS CAMPOSELECIONADO from TABELA
This would work for you.