January 31, 2010 at 9:43 pm
Hi There,
Please suggest best way to do this
insert into table(value1,value2)
values ('123', select id from table where section='section 1')
value2 is the foreign key value from the second table
but this doesnt work,i have to declare a variable and set the above select value into the variable
and replace this above select statement with the variable
Please suggest best way to achieve this
Thanks
January 31, 2010 at 9:46 pm
forum member (1/31/2010)
Hi There,insert into table(value1,value2)
values ('123', select id from table where section='section 1')
Try this instead.
insert into table(value1,value2)
SELECT '123', id from table where section='section 1'
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy