Consider this simple query
Query
INSERT INTO NewCourses (name, location, gid) from
SELECT name, location, 1
FROM courses
which does nothing but insert all records from table courses to table NewCourses .
But if I would like to return this same select statement what will I do? Without this I need to run this insert statement then again run the same select statement like
INSERT INTO NewCourses (name, location, gid) from
SELECT name, location, 1
FROM courses
//THIS IS THE WASTE OF TIME
SELECT name, location, 1
FROM courses
Please let me know if it is possible?