KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I could solve it with php or some other language but I am keen to learn more SQL. Is there a way to solve this: I have two tables (and I can't change the structure), one content with some data and the other content_info with some additional information. They are related that way: content.id = content_info.content_id . What I would like to do: If there is no dataset in content_info but in content , I would like to copy it over, that at the end there are the same number of datasets in both tables. I tried it that way, but unfortunately it doesn't work: ... BEGIN (SELECT id, ordering FROM content;) cont:LOOP @cid = SELECT content_id FROM content_info WHERE content_id = (id) IF @cid != (id) THEN INSERT INTO content_info SET content_id = (id), ordering = (ordering) ITERATE cont; END IF; END LOOP cont; END .. Has someone an idea, or isn't it possible at the end? Thanks in advance!
Tags (comma-separated)
Save Edits
Cancel