0

I need to update one field in one table where the ID matches. I just cant get he syntax right! This is what I have below:

SELECT id_col from Table1 (INSERT INTO Table1 (`Date`) VALUES (`2013-10-07`) WHERE `id_col`=`7949`);

I am sure it is something simple I am missing .

2
  • That's not valid SQL. You can INSERT INTO a table (but you can't specify a where clause) You can SELECT from a table (with a where clause) You can SELECT FROM a table (with a where clause) and insert the rows INTO another table You can't SELECT from an INSERT statement Since your SQL makes no sense it's hard to work out what you want to do - try explaining it in words. Commented Mar 26, 2014 at 15:17
  • Hi, thanks for the help. I didn't realise you couldn't do both at once. The Update syntax makes much more sense! You can tell i'm new to this! Commented Mar 26, 2014 at 15:24

2 Answers 2

1

Update Syntax :

UPDATE table_name
SET column1=value, column2=value2,...
WHERE some_column=some_value

Examle :

UPDATE Table1 
  setDate= '2013-10-01' 
    WHERE id_col = '7949'
Sign up to request clarification or add additional context in comments.

2 Comments

is ok we where all new at some point ! kkk If your question was answered mark the correct answer !
Trying now, I have 50 seconds to go before it allows me. Thanks again!
0
UPDATE Table1 set Date= '2013-10-01' WHERE id_col = '7949'

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.