Im trying to insert 'testing' into my MeetingNotes column under two conditions but for the life of me I cannot get it to work. Is it possible to do this? I am a beginner with sql and mysql? Thanks in advance!
SELECT MeetingNotes
FROM Meeting
INSERT INTO MeetingNotes
VALUES ('testing')
WHERE MeetingProcessId = '1001' AND MeetingId = '25'
You want to use an UPDATE query, which changes values in existing records. An INSERT query strictly adds new records.
UPDATE Meeting
SET MeetingNotes = 'testing'
WHERE MeetingProcessId = '1001' AND MeetingId = '25'
For future reference, I'm not sure why you have a SELECT statement in your example: it isn't needed to insert or update records. Inserting a new record into the Meeting table (given only the three columns shown) would look like this:
INSERT INTO Meeting (MeetingId, MeetingProcessId, MeetingNotes)
VALUES ('25', '1001', 'Notes about this very exciting meeting...')
A couple notes on this:
MeetingId
is an auto-incrementing record ID generated by the database, it should be / must be left out of INSERT statements25
and 1001
in the queries above should be removedWhat you want is probably:
UPDATE Meeting SET MeetingNotes='testing' WHERE MeetingProcessID = '1001' AND MeetingId = '25';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With