1

I am confused by how my SELECT query is behaving. Accidentally I read the header row of a .csv file into my table. This means there is now one row in the table which has the column values in each corresponding column.

But a SELECT like this

select * from `mytablename` where segmentering=`segmentering`;

Returns all the rows in the table.

Why is MySQL ignoring the condition?

disasterkid
  • 6,948
  • 25
  • 94
  • 179
  • 3
    It isn't `segmentering` is enclosed in backticks which means the column is being compared to itself.https://stackoverflow.com/questions/11321491/when-to-use-single-quotes-double-quotes-and-backticks-in-mysql – P.Salmon May 21 '19 at 07:24

4 Answers4

1

it should be 'segmentering' not with back tick(``)

select * from `mytablename` where segmentering='segmentering'
Fahmi
  • 37,315
  • 5
  • 22
  • 31
1

Problem is you use single quote ` object identifier for strings. instead of it use normal single quote:

select * from `mytablename` where segmentering='segmentering';
void
  • 7,760
  • 3
  • 25
  • 43
1

I guess the problem is with you are adding back quotes(``) with the value field. Back quote will be used for specifying column or table names. It should not be used with the value.

Try using,

select * from `mytablename` where `segmentering`='segmentering';

OR

select * from `mytablename` where segmentering='segmentering';
anoop v m
  • 141
  • 1
  • 8
0

Try this

select * from `mytablename` where segmentering='segmentering';

Remove `` and replace '';

I hope it will work for you

SAVe
  • 814
  • 6
  • 22