Insert a single value into a column with a where clause

I am trying to insert 'testing' into the MeetingNotes column under two conditions, but for life I cannot get it to work. Is it possible to do this? Am I new to sql and mysql? Thanks in advance!

SELECT MeetingNotes
FROM Meeting
INSERT INTO MeetingNotes
VALUES ('testing')
WHERE MeetingProcessId = '1001' AND MeetingId = '25'
+5
source share
2 answers

You want to use an UPDATE query that modifies values ​​in existing records. The INSERT query strictly adds new entries.

UPDATE Meeting
SET MeetingNotes = 'testing'
WHERE MeetingProcessId = '1001' AND MeetingId = '25'

In the future, I'm not sure why there is a SELECT statement in your example: there is no need to insert or update records. Inserting a new record into the collection table (only for the three columns shown) looks like this:

INSERT INTO Meeting (MeetingId, MeetingProcessId, MeetingNotes)
VALUES ('25', '1001', 'Notes about this very exciting meeting...')

The couple notes this:

  • INSERT , , WHERE
  • MeetingId - , , / INSERT.
  • (CHAR/VARCHAR) , , . , , , MeetingId MeetingProcessId , , 25 1001
+10

, :

UPDATE Meeting SET MeetingNotes='testing' WHERE MeetingProcessID = '1001' AND MeetingId = '25';
+2

All Articles