jessica
jessica

Reputation: 1687

Char_length not working in select statement

I have a SQL statement that works without the char_length part, but when I added in the char_length part, a SQL error shows up, saying there's an error at line 6. I'm not sure what I did wrong. Please take a look:

SELECT response, ( input LIKE  '% one %' ) as matches
FROM allData
WHERE (char_length(input) >= '10'-(10*.1) 
AND char_length(input) <= '10'+(10*.1)) 
HAVING matches > 0 
AND matches = (select max(( input LIKE  '% one %' )) from allData) limit 30;

Upvotes: 2

Views: 88

Answers (1)

Gabe
Gabe

Reputation: 1183

you just had a problem on the last line instead. You had two extra ( ). I've changed it to:

AND matches = (select max( input LIKE  '% one %' ) from allData limit 30);

look at this full fiddle. It works ok without error: http://sqlfiddle.com/#!9/f1113/2

Upvotes: 3

Related Questions