mysql - SQL query to insert same value 1000 times without loop -
for example, if have string 'sunday', want insert same value in 1000 rows using sql only; without using loops.
if don't want use table can use:
insert some_table (some_column) select 'sunday' ( select 1 (select 1 union select 2) d1 join (select 1 union select 2) d2 join (select 1 union select 2) d3 join (select 1 union select 2) d4 join (select 1 union select 2) d5 join (select 1 union select 2) d6 join (select 1 union select 2) d7 join (select 1 union select 2) d8 join (select 1 union select 2) d9 join (select 1 union select 2) d10 ) t limit 1000
you can adjust amount of join's depending on limit want.
Comments
Post a Comment