Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

MySQL Select Insert with a constant field

I have an SQL querty which works great:-

insert into myTable select * from otherTable;

but what Id like to do is insert another column which is constant, so something like

insert into myTable `firstColumnValue' select * from other table.

Does this make sence?
Avatar of tonelm54
tonelm54

ASKER

So in the first query the result would inserts:-
Col1      Col2      Col3      Col4      Col5
--------------------------------------------------------------------------------------------------------------------------
value11      value12      value13      value14      value15
value21      value22      value23      value24      value25
value31      value32      value33      value34      value35
value41      value42      value43      value44      value45
value51      value52      value53      value54      value55
value61      value62      value63      value64      value65
value71      value72      value73      value74      value75

The second Id like to insert:-
Col1      Col2      Col3      Col4      Col5      Col6
--------------------------------------------------------------------------------------------------------------------------myConstValue      value11      value12      value13      value14      value15
myConstValue      value21      value22      value23      value24      value25
myConstValue      value31      value32      value33      value34      value35
myConstValue      value41      value42      value43      value44      value45
myConstValue      value51      value52      value53      value54      value55
myConstValue      value61      value62      value63      value64      value65
myConstValue      value71      value72      value73      value74      value75
ASKER CERTIFIED SOLUTION
Avatar of Gunwant Saini
Gunwant Saini
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial