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.

5
  • Wt ab other names? Does it work?
    – Penguine
    May 9, 2021 at 6: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 9, 2021 at 6:38
  • With other tables, it works just fine. I do remember changing the character format by applying the solution here. 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 9, 2021 at 6: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 9, 2021 at 6: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 9, 2021 at 7:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.