|
|
Subject:
mysql if else statement
Category: Computers > Programming Asked by: stephen67-ga List Price: $2.00 |
Posted:
21 Mar 2006 19:39 PST
Expires: 20 Apr 2006 20:39 PDT Question ID: 710350 |
|
There is no answer at this time. |
|
Subject:
Re: mysql if else statement
From: daemon_byte-ga on 22 Mar 2006 08:09 PST |
you dont mention and end if if f5='Kiosk' then select f1, f2, f3, f4 from t1 where f5=Kiosk' from t1; else select f1, f2, f3, f6 from t1 where f5='Store' from t1; END IF; |
Subject:
Re: mysql if else statement
From: stephen67-ga on 22 Mar 2006 12:54 PST |
If this the entier statement? Cause I am not getting it to work mysql> use store_data Database changed mysql> select Location_Type from stores_new -> if Location_Type='Kiosk' -> then -> select Store_Name, Location_Type where Location_Type='Kiosk' from stores_new -> else -> select Store_Name, Location_Type from stores_new where Location_Type='Kiosk CC' from stores_new -> end if; ERROR 1064 (42000): 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 'if Location_Type='Kiosk' then select Store_Name where Location_Type='Kiosk' from' at line 2 mysql> |
Subject:
Re: mysql if else statement
From: nelson-ga on 22 Mar 2006 19:51 PST |
select f1, f2, f3, case f5 when 'Kiosk' then f4 when 'Store' then f6 end from t1 |
Subject:
Re: mysql if else statement
From: stephen67-ga on 30 Mar 2006 17:07 PST |
mysql> use store_data Database changed mysql> select Store_Name, City case Location_Type when 'Kiosk' then Location_Type when 'CC Kiosk' then State end from stores_new; ERROR 1064 (42000): 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 'case Location_Type when 'Kiosk' then Location_Type when 'CC Kiosk' then State en' at line 1 |
Subject:
Re: mysql if else statement
From: rafaeljusi-ga on 17 Apr 2006 12:35 PDT |
try: select f1, f2, f3, if(f5='Kiosk',f4,f6) from t1 |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |