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.
| Author |
Topic |
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-10-06 : 18:54:47
|
| There are 2 tables as shown below. The Prd id is same as the Order id. But there are some Prd names that do not exists and some type that do not exists. Need to create a new table and insert all the values in that. For Example:32145 Chairs furniture32410 Tables Null12345 null miscPrd table Prd id, 32145 32410Prd Name chairs tablesOrder tableOrder id, 32145 12345Prd type furniture misc SA |
|
|
sanoj_av
Posting Yak Master
118 Posts |
Posted - 2009-10-06 : 23:52:32
|
| [quotethere are some Prd names that do not exists and some type that do not exists. [/quote]Do no exist where? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-10-07 : 00:23:53
|
[code]insert into new_table(id, prd_name, prd_type)select p.prd_id, p.prd_name, o.prd_typefrom prd p inner join order o on p.prd_id = o.order_id[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|