I am trying to insert list of items from dev.test1 table, but I am struggling with logic ...
Face following problems:
Query:
INSERT INTO dev.qa_posts (type, categoryid, userid, created, title, content, tags)
(SELECT 'Q_QUEUED', '1', '3', NOW(), f.title, f.img, f.tagsv
FROM dev.test1 f)
LIMIT 1;
INSERT INTO dev.qa_postmetas (postid, title, content)
(select MAX(b.postid) , 'qa_q_extra',f.URL
from dev.qa_posts b
left JOIN dev.test1 as f on b.postid = f.id)
LIMIT 1 ;
Any assistance will be appreciated
To avoid emty records try IS NULL function in MySQL.
Second query you join to another one and limiting insertion to one. You may have more results from joined query then you attemt to insert.
Debug your second join select to check what results you have. Take out limitation to insert all records from joined queries.
Is that what you mean?