SQL insert and select at once

Just got a good lesson from a friend i met in internet, its bout SQL, so this post is to remind me how to insert and select from sql data base in one query.

INSERT tableA(id,name,contents)
SELECT DISTINCT id, title, page_content FROM tableB
WHERE title= $strtomatch

Thank you my friend

CategoriesIT