1

I have a table named contacts

enter image description here

and I can't get a result when doing SELECT with a condition that asks for a value in the name column, even when I try a value that comes from the table.

enter image description here

Although if copied the value directly from the table, and pasted it in the query, the expected result gets returned. It works when copy-pasted from the table:

enter image description here

The two query statements are virtually the same, but different results arrive.

Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
Nagusameta
  • 109
  • 8
  • Wt ab other names? Does it work? – Penguine May 09 '21 at 06:35
  • 3
    Are you sure that the invisible character 'space' which is between the name and surname is actually a space and not a tab for example? To see where the problem is instead of `=` use `like` and wildcards `%` for example `Select * from contacts where name like '%Shelly%Bird%'` – Combinu May 09 '21 at 06:38
  • With other tables, it works just fine. I do remember changing the character format by applying the solution [here](https://stackoverflow.com/questions/38363566/trouble-with-utf-8-characters-what-i-see-is-not-what-i-stored). This was because at some point, black diamonds were being displayed in the page when I try to display values retrieved from the database – Nagusameta May 09 '21 at 06:40
  • 3
    Than you are not using plain text. There is some special characters in the name which in the sql editor are not being displayed. Edit the name field manually or otherwise when you perform the select you MUST include also those special characters. That is why the copy and paste is working, its because you are pasting those special characters – Combinu May 09 '21 at 06:42
  • I copy-pasted the values from Excel that I used for the INSERT queries, could that have been the problem source? For the other tables that work fine, I manually typed in the values for each row – Nagusameta May 09 '21 at 07:57

0 Answers0