Closed Thread
Old 07-30-2010, 09:02 AM SQL error
Super Talker

Posts: 104
Trades: 0
simple SQL statement or so I thought but I am am being blocked by an error.

Any comment?

Error message
Quote:
#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 'WHERE sso IS NOT NULL' at line 3
SQL statement
Quote:
INSERT INTO tbl_staff( interface, interface_iso )
VALUES ( 1111111111111111, 11111 )
WHERE sso IS NOT NULL

Select statement that works
Quote:
SELECT `sso` , `interface` , `interface_iso`
FROM `tbl_staff`
WHERE sso IS NOT NULL
dgkindy is online now
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 07-30-2010, 09:07 AM Re: SQL error
chrishirst's Avatar
Super Moderator

Posts: 32,241
Location: Blackpool. UK
Trades: 0
You cannot use WHERE clauses in an INSERT query.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2010, 12:47 PM Re: SQL error
Super Talker

Posts: 104
Trades: 0
so if I have several records that need to be updated, how would one go about just updating the specific records based on a given condition?
dgkindy is online now
View Public Profile
 
Old 07-30-2010, 12:51 PM Re: SQL error
chrishirst's Avatar
Super Moderator

Posts: 32,241
Location: Blackpool. UK
Trades: 0
Well, that would need an UPDATE query NOT an INSERT
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Code Samples | Crowded Nightclub? | Random Ramblings
chrishirst is online now
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2010, 09:55 PM Re: SQL error
Super Talker

Posts: 104
Trades: 0
ahhhh, thank you.
dgkindy is online now
View Public Profile
 
Closed Thread     « Reply to SQL error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12776 seconds with 13 queries