How to insert values in to one table, data from two different tables?
-
Hi, I am having 3 tables... in the third table(Table C) i want to insert the values... which i am having datas( some datas not all) in the first(Table A) and second table(some vales not all) (Table B), by single insert.... how to do this??..
Try something like
INSERT INTO TableC SELECT TableA.Field, TableB.Field FROM TableA, TableB
thatraja
-
Hi, I am having 3 tables... in the third table(Table C) i want to insert the values... which i am having datas( some datas not all) in the first(Table A) and second table(some vales not all) (Table B), by single insert.... how to do this??..
INSERT INTO TABLEC
SELECT tableb.col1,tableb.col1 FROM tablea, tableb
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com
-
INSERT INTO TABLEC
SELECT tableb.col1,tableb.col1 FROM tablea, tableb
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com
-
if there no restrictions of this script,there must have some repeat results,like if the tableb have 3 rows,the tablec have 3 rows,there will be exists 9 rows,how to solve this? :confused:
My previous post for this thread was only example how to do the insert from select statement. For more specified case then it must have other conditions on select statement and so. :)
I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com