MySQL Forums
Forum List  »  Newbie

Insert single row from multiple queries
Posted by: Todd Lane
Date: April 24, 2018 07:37PM

Hi, What should I be searching for or how does 1 do an insert a single record into a table, the results from multiple queries?

Each result from the table is individual & not relay on another table so I'm not sure that the AND is going to make it work (in fact it doesn't)

Thanks in advance

for example
INSERT INTO `Table1`
(`ColumnA`,
`ColumnB`,
`ColumnC`,
`ColumnD`
)

SELECT 'Peice of text', `Table2`.`ID`, `Table3`.`ID`, `Table4`.`ID`
from `Table2`, `Table3`, `Table4`
where `Table2`.`ColumnB` = 'Blah'
and `Table3`.`ColumnB` = 'Yeah'
and `Table4`.`ColumnB` = 'Yeah Blah';

Options: ReplyQuote


Subject
Written By
Posted
Insert single row from multiple queries
April 24, 2018 07:37PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.