D
directmail
Hello,
I am trying to insert rows in a table by doing a select from another table.
I have a field in the table whose data needs to be static
For example: Tab1 is the table that I am trying to insert into
tab1.field1 -> data comes in from tab2.field10
tab1.field2 -> data comes in from tab2.field11
tab1.field3 -> static string like 'FIRST GROUP'
I was able to successfully run the following query:
insert into tab1 ( field1, field2 )
select field10, field11
from tab2
where field1 = 'some condition'
I want to change this insert statement to :
insert into tab1( field1, field2, field3 )
select field10, field11 from tab2 where field1 = some condition
< and the static value for tab1.field3 >
No matter what combinations I have tried, I get an error on the insert
statement syntax.
How should I do this.
Thanks
Girish
I am trying to insert rows in a table by doing a select from another table.
I have a field in the table whose data needs to be static
For example: Tab1 is the table that I am trying to insert into
tab1.field1 -> data comes in from tab2.field10
tab1.field2 -> data comes in from tab2.field11
tab1.field3 -> static string like 'FIRST GROUP'
I was able to successfully run the following query:
insert into tab1 ( field1, field2 )
select field10, field11
from tab2
where field1 = 'some condition'
I want to change this insert statement to :
insert into tab1( field1, field2, field3 )
select field10, field11 from tab2 where field1 = some condition
< and the static value for tab1.field3 >
No matter what combinations I have tried, I get an error on the insert
statement syntax.
How should I do this.
Thanks
Girish