|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
insert syntax error
Hi I have this insert statement
insert into useraccount (user_id,acc_id,acc_type_id,acc_bal,acc_open_date, acc_status,loan_amount) SELECT 2,acc_id,3,5000,curdate(),1,5000 FROM dual WHERE NOT EXISTS (select * from useraccount where useraccount.user_id =2 and useraccount.acc_type_id=3); It is basically if the acc_type_id = 3 record doesn't exists then it should insert otherwise it should not insert. But it gives me error in the query, can anyone help me out. |
|
#2
|
||||
|
||||
|
You should check which version of MySQL you are using. subqueries in the WHERE clause were not introduced until version 4.1, which is currently only a Beta release.
You might have derived this code from SQL, where is has been available much longer. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > insert syntax error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|