June 28th, 2013, 05:54 AM
Selecting "...WHERE mycol = '2\'' " returns same as "...WHERE mycol = '2' ". Why?
"SELECT FROM myTable WHERE mycol = '2\'' "
returns the same results as if you run:
"SELECT FROM myTable WHERE mycol = '2' ".
One has an apostrophe after the value and one doesn't. Why would mysql treat them the same? I don't understand this behavior.
Note, if you put the apostrophe BEFORE the value, mysql reads them differently. Which would seem to be the correct behavior.
Operating system ubuntu 12.04
June 28th, 2013, 06:45 AM
try this --
two consecutive single quotes is what you use to represent a single quote
WHERE mycol = '2'''
a similar example --
WHERE lastname = 'O''Toole'