Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 insert select

Author  Topic 

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-10-08 : 03:17:12
i have 3 table

a1
-----------------------
phone suret tarix kodprov
111 1024 2012.02.01 2


a2
----------------------
kodprov provayder

2 self



a3
----------------
phone suret tarix prov

how i make insert select to table a3

by example

a3
----------------------------------
phone suret tarix prov
111 1024 2012.02.01 self


http://sql-az.tr.gg/

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-10-08 : 03:42:26
[code]
insert into a3 (phone, suret, tarix, prov)
select a1.phone, a1.suret, a1.tarix, a2.provayder
from a1
inner join a2 on a1.kodprov = a2.kodprov
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-10-08 : 03:53:51
thak you very much

http://sql-az.tr.gg/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-08 : 05:28:43
suggest you to refer below link to get an idea of how joins work

http://www.w3schools.com/sql/sql_join.asp

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-10-08 : 08:35:53
thank you very much visakh



http://sql-az.tr.gg/
Go to Top of Page
   

- Advertisement -