我必须在我的数据库中获取一个联系人,但我的查询只返回我的联系人姓名中没有空格的地方,例如:“John”,如果我有“John Locke”,它不会返回,像这样:
这是我的选择:
SELECT c.nome AS nomeContato, c.cpf, c.email, c.grupo, c.informacoes_complementares,
en.logradouro, en.bairro, en.numero, en.complemento, en.cep, en.municipio, en.uf,
e.nome AS nomeEmpresa, e. cnpj, t.numero AS telefone
FROM contato AS c
INNER JOIN endereco AS en ON c.id_contato = en.id_contato
INNER JOIN empresa AS e ON c.id_contato = e.id_contato
INNER JOIN telefone AS t ON c.id_contato = t.id_contato
WHERE c.nome LIKE "Homer";
在此选择中,它返回“荷马”记录,但如果我尝试
SELECT c.nome AS nomeContato, c.cpf, c.email, c.grupo, c.informacoes_complementares,
en.logradouro, en.bairro, en.numero, en.complemento, en.cep, en.municipio, en.uf,
e.nome AS nomeEmpresa, e. cnpj, t.numero AS telefone
FROM contato AS c
INNER JOIN endereco AS en ON c.id_contato = en.id_contato
INNER JOIN empresa AS e ON c.id_contato = e.id_contato
INNER JOIN telefone AS t ON c.id_contato = t.id_contato
WHERE c.nome LIKE "Bruce Waine";
它不返回,但两个联系人都在数据库中,有什么想法吗?
提前致谢。
已编辑我很笨,我的数据库崩溃了,我已经删除它并再次重新构建,现在选择正在工作!谢谢大家