Here are two ways, both of which allow you not to repeat the subtitle, but not strictly "in one request":
1) Use a temporary variable
SET @b = SELECT foo FROM someothertable WHERE somecondition; INSERT INTO tablename(a, b) VALUES ( (1, @b), (2, @b), ...
2) Use insert to set column a , then use update to set column b . This can be put into a temporary table.
CREATE TEMPORARY TABLE tmp LIKE tablename; insert into tmp(a) values (1),(2),... update tmp set b = select foo from someothertable where some_condition; insert into tablename(a,b) select * from tmp;
source share