MySQL Forums
Forum List  »  MySQL Workbench

Error in SQL query
Posted by: Robin John
Date: April 03, 2019 01:51AM

I am a newbie in Database. I am trying to understand the working of MySQL Workbench by trying to manipulate a few databases.

To do so I am first learning to manipulate two tables in one database. To do so I wrote the following query.

DECLARE status_post INT DEFAULT 0
START TRANSACTION;
INSERT INTO wp_text (Id, Titel, Inleiding, Tekst, Datum)
SELECT Id, Titel, Inleiding, Tekst, Datum
FROM teksten;

SELECT Active from teksten INTO status_post;

IF status_post = 1 THEN
INSERT INTO wp_text (Active) (`publish`);
ELSE
INSERT INTO wp_text (Active) (`pending`);
COMMIT;
END IF;

But obviously there is a syntax error. I tried to search it online but all in vain. Can anyone guide me into the right direction and tell me what am I doing wrong?

Thanks in advance.

Robin

Options: ReplyQuote


Subject
Views
Written By
Posted
Error in SQL query
379
April 03, 2019 01:51AM
171
April 03, 2019 02:09AM
233
April 03, 2019 11:12PM
176
April 03, 2019 11:25PM
212
April 04, 2019 10:00AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.