I've been researching the internet and hearing rumors that it's possible to use if else
in MySQL queries but have not seen anything concrete about it. Is it really possible? If so, how?
I want to make a query in three distinct tables in search of the column name I have the following query as an example
SELECT 'PAIS'.nome, 'FILHOS'.nome, 'NETOS'.nome FROM 'PAIS', 'FILHOS', 'NETOS' WHERE 'PAIS'.nome LIKE '%MATILDE%' OR 'FILHOS'.nome LIKE '%MATILDE%' OR 'NETOS'.nome LIKE '%MATILDE%'
This query will query the three tables PAIS, FILHOS, NETOS
searching for '%MATILDE%'
in the name field
Now I want to do as in this example but with SE
SE encontrar '%MATILDE%' na tabela NETOS CONCATENAR
CONCAT(' É FILHA DE ', FILHOS.nome),
CONCAT(' E NETA DE ', PAIS.nome)
SE encontrar '%MATILDE%' na tabela PAIS CONCATENAR
CONCAT(' É MAE DE ', FILHOS.nome),
CONCAT(' E AVO DE ', NETOS.nome)
I want to implement something like this.