Is there a quick way to insert multiple values โโinto one column, and the second column has a different value.
Let's say I have two columns named Number and Colour . The Number column will always be 1, and the Colour column will change.
Currently I am doing the following ...
INSERT INTO ColourTable(Number, Colour) SELECT '1' ,'red' UNION ALL SELECT '1' ,'yellow' UNION ALL SELECT '1' ,'green' UNION ALL SELECT '1' ,'blue' UNION ALL SELECT '1' ,'orange'
Which is good if there are only a few inserts, but the problem is that I need to insert about 100 rows with changing the color column, and I was wondering if there is a way to set the column of numbers?
** I think I need to explain myself a little better ...
say that in the columns of the color 40 different colors I need to insert these colors in different lines with the column number saying from 1 to 100 (the number is actually randon code, so the increment will not work).
So I need to do 40 inserts of color rows with column number = 1 40 inserts with column number = 2 40 inserts with column number = 3, etc. Up to 100
source share