<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>When creating a view in phpmyadmin on yahoo business I need to know the corrct syntax to return text. Below are two examples of an If statement and a case statement that return an Integer. Both of these views work correctly. There are also three examples of an If statement to return text and three examples of case statements to return text. None of these six examples work correctly even when using using single quotes, double qoutes or no quotes at all. Please review all of the below examples and let me know what is happening that the select statement changes.<br><br>SELECT If(Month(Now())=2,555,999)</div><div> works correctly<br><br>SELECT case Month(now()) when 2 then 555 else 999 end</div><div> works correctly<br><br>SELECT If(Month(Now())=2,'Feb','Oth')<br> changes the select statement
to:<br> SELECT If(Month(Now())=2,\'Feb\',\'Oth\')<br> and gives error:<br> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'Feb\',\'Oth\')' at line 5<br><br>SELECT If(Month(Now())=2,"Feb","Oth")<br> changes the select statement to:<br> SELECT If(Month(Now())=2,\"Feb\",\"Oth\")<br> and gives error:<br> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\"Feb\",\"Oth\")' at line 5<br><br>SELECT If(Month(Now())=2,Feb,Oth)<br> gives below error:<br> #1054 - Unknown column 'Feb' in 'field list' <br><br><br>SELECT case Month(now()) when 2 then 'Feb' else 'Other' end<br> changes the
select statement to:<br> SELECT case Month(now()) when 2 then \'Feb\' else \'Other\' end<br> and gives error:<br> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'Feb\' else \'Other\' end' at line 5 <br><br>SELECT case Month(now()) when 2 then "Feb" else "Other" end<br> changes the select statement to:<br> SELECT case Month(now()) when 2 then \"Feb\" else \"Other\" end<br> and gives below error:<br> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\"Feb\" else \"Other\" end' at line 5<br><br>SELECT case Month(now()) when 2 then Feb else Other end<br> gives below error:<br> #1054 - Unknown
column 'Feb' in 'field list'</div></div></body></html>