Reputation: 3560
I have a chemistry database (very small, about 60kb or so) in a mysql database. My
select * from firstdatabase;
works fine with any column but symbol. When I do
select * from firstdatabase where symbol = "Y";
for example, I get an empty set. However, when I do
select symbol from firstdatabase;
I get every symbol in the database including "Y". This problem doesn't occur with any other field except symbol. I have also tried it with double lettered and triple lettered elements to no avail. Please help?
Upvotes: 0
Views: 51
Reputation: 1943
Use LTRIM and RTRIM if there whitespace characters in your symbol column.You should try LTRIM
and RTRIM
function.
select * from firstdatabase where LTRIM(RTRIM(symbol))= 'Y'
Upvotes: 0
Reputation: 155
My first guess is your symbol
column contains whitespace characters. So you should try TRIM
function.
select * from firstdatabase where TRIM(symbol) = "Y"
Upvotes: 1