php - Multiple Select statements into an Insert statement -


i've been searching while , i'm not sure if allowed in mysql.

i know allowed in mysql

insert 'table' (column1, column2, column3) select val1, val2, val3 sometable

also this

insert 'table' (column1, column2, column3) values (val1, val2, val3), (val1, val2, val3)

i not sure if allowed though:

insert 'table' (column1, column2, column3) select val1, val2, val3 sometable, select val1, val2, val3 sometable

obviously gave me error, allowed in mysql?

you can try it, , fail. use union all instead of ,:

insert table (column1, column2, column3)     select val1, val2, val3 sometable     union     select val1, val2, val3 sometable; 

i assume single quotes there sort of effect, because first 2 queries work.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -