|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
I am trying to execute an IF statement in MySQL (something I rarely do) but I keep receiving the error:
"Invalid Query: 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 SELECT "...rest of statement. I am using the following SQL statement executed by PHP's mysql_query() function: "IF SELECT something FROM my_table WHERE something='4935' AND whatever='N' THEN INSERT INTO my_table (something,next_thing,whatever) VALUES('4935','some text','N') ELSE INSERT INTO my_table (something,next_thing) VALUES('4935','some text') END IF" Any ideas what might be wrong? Thanks! MySQL verion 4.0.18 with PHP 4.3.6. |
|
#2
|
|||
|
|||
|
Quote:
Why post Mysql questions in a SQL server forum? Mysql does not support if statements in version 4. |
|
#3
|
|||
|
|||
|
Ahhh...that explains that.
For some reason I thought the forum said MySQL not MS SQL. ![]() |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Please help with IF statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|