7
I perform a query in a table in my Mysql database that returns the following fields to me: usuarioId
nome
sobrenome
idade
sexo
escolaridade
modeloNome
hora
Follow the sql below:
SELECT
sv_users.userID as `usuarioId`,
sv_users.userNome as `nome`,
sv_users.userSobrenome as `sobrenome`,
sv_users.userDataNascimento as `idade`,
sv_users.userSexo as `sexo`,
sv_users.userEscolaridade as `escolaridade`,
sv_modelos.modelNome as `modeloNome`,
sv_jogo.`Data` as `hora`
FROM sv_jogo
INNER JOIN sv_users ON sv_jogo.UsuarioId = sv_users.userID
INNER JOIN sv_modelos ON sv_users.userModelId = sv_modelos.modelId
WHERE
(sv_users.userNome LIKE 'Luitame%' OR sv_users.userSobrenome LIKE 'Luitame%')
OR
(sv_users.userNome LIKE '%Luitame' OR sv_users.userSobrenome LIKE '%Luitame')
OR
(sv_users.userNome = 'Luitame' OR sv_users.userSobrenome = 'Luitame')
So far all quiet, returns me waiting. As below:
It’s just that you can browse the field and compare the contents. I wanted it to be possible to perform a full name query or only part of the full name. Example: "Luitame de Oliveira" and the query return me some record, because following the above query it only returns me some value if I search for the nome
or sobrenome
. But if I make the junction of nome + sobrenome
the query does not return me anything.
As in the example below:
SELECT
sv_users.userID as `usuarioId`,
sv_users.userNome as `nome`,
sv_users.userSobrenome as `sobrenome`,
sv_users.userDataNascimento as `idade`,
sv_users.userSexo as `sexo`,
sv_users.userEscolaridade as `escolaridade`,
sv_modelos.modelNome as `modeloNome`,
sv_jogo.`Data` as `hora`
FROM sv_jogo
INNER JOIN sv_users ON sv_jogo.UsuarioId = sv_users.userID
INNER JOIN sv_modelos ON sv_users.userModelId = sv_modelos.modelId
WHERE
(sv_users.userNome LIKE 'Luitame de Oliveira%' OR sv_users.userSobrenome LIKE 'Luitame de Oliveira%')
OR
(sv_users.userNome LIKE '%Luitame de Oliveira' OR sv_users.userSobrenome LIKE '%Luitame de Oliveira')
OR
(sv_users.userNome = 'Luitame de Oliveira' OR sv_users.userSobrenome = 'Luitame de Oliveira')
Check out the result:
Any suggestions?
That’s what gives:
[Err] 1214 - The used table type doesn't support FULLTEXT indexes
– Luitame
Luitame, you must be using an Innodb table in a version prior to Mysql 5.6.4. Update your Mysql. For testing (not recommended) you can change the table engine to Myisam:
ALTER TABLE sv_users ENGINE = MYISAM;
, but in production it’s not worth it unless you know what you’re doing.– Anthony Accioly