On a system, I have 03 internal search types:
And I would like to look at 03 unrelated tables:
table1, table2, and table3
For this, I tried the commands below:
SELECT * FROM 'tabela1' WHERE NomeUsuarios LIKE 'Davi%' UNION SELECT * FROM 'tabela2' WHERE NomeUsuarios LIKE 'Davi%' UNION SELECT * FROM 'tabela3' WHERE NomeUsuarios LIKE 'Davi%'
The top one, gave the error below:
1222 - SELECT statements used have different number of columns
I tried this search and also could not:
SELECT * FROM 'tabela1', 'tabela2', 'tabela3' WHERE tabela1.NomeUsuarios LIKE 'Davi%' OR tabela2.NomeUsuarios LIKE 'Davi%' OR tabela3.NomeUsuarios LIKE 'Davi%'
It returns me all the names, regardless of whether they are David or not. How can I do this search?