Value with _ (underscore)

Fragen und Probleme rund um die Abfragespache SQL.
Antworten
jcarlson
Neuer Benutzer
Beiträge: 2
Registriert: Di 23. Apr 2019, 13:58

Value with _ (underscore)

Beitrag von jcarlson » Di 23. Apr 2019, 14:03

Hey Guys,

I have a strange behaviour (at least for me).

I have 3 values in one of my columns.

1. 1550_1010
2. 1610_1010
3. 1610test

No results even if I would expect one:
SELECT * FROM chart WHERE accno = '1550_1010';
SELECT * FROM chart WHERE accno IN ('1550_1010');

Suddenly a result but I just added another IN term...
SELECT * FROM chart WHERE accno IN ('1550_1010', '');

Gives me a result but only as long as I have the value 1610test in there...
SELECT * FROM chart WHERE accno = '1610_1010';
SELECT * FROM chart WHERE accno IN ('1610_1010');

Is this somehow a known "issue" or is this for some reason a logicaly explainable?

Cheers,
JC

castorp
Erfahrener Benutzer
Beiträge: 1125
Registriert: Sa 27. Jun 2009, 22:24
Wohnort: Bayern

Re: Value with _ (underscore)

Beitrag von castorp » Di 23. Apr 2019, 14:17

Works for me: https://rextester.com/FLMD88939

I guess there is something you are not telling us.
A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'

jcarlson
Neuer Benutzer
Beiträge: 2
Registriert: Di 23. Apr 2019, 13:58

Re: Value with _ (underscore)

Beitrag von jcarlson » Fr 26. Apr 2019, 15:30

Yeah, meanwhile I figured out, deleting the record and reinserting it solves the problem.

Any idea what could possibly have gone wrong on the first insert?

Antworten