-2
我必須在我的數據庫中獲取聯繫人,但我的查詢只返回我的聯繫人名稱中沒有空格的名稱,例如:「John」,如果我有「洛克」它沒有回報,這樣的事情:在Mysql中沒有檢索到帶空格的數據SELECT
這是我的選擇:
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";
它不返回,但兩個聯繫人在數據庫中,有一些想法?
在此先感謝。
EDITED 我是笨拙的,我的數據庫崩潰了,我刪除了它並重新重新構建,現在選擇工作了! Thanks all
你爲什麼用'LIKE'代替'='? – 2012-07-15 22:23:22
看看你的標題!?! – markus 2012-07-15 22:25:41
我試過使用「=」並且它不起作用:( – guisantogui 2012-07-15 22:26:36