Click here to Skip to main content
11,803,019 members (78,030 online)
Rate this: bad
Please Sign up or sign in to vote.
I have three table names like inventory, inventory_temp and purchase

 create table inventory(id int,productid int,quantity decimal(18,4), disptchtype int)
   create table inventory_temp(id int,productid int,quantity decimal(18,4), disptchtype int ,loaded_qnty decimal(18,4))
 create table purchase (id int,productid int,loaded_qnty decimal(18,4))
insert into inventory values(1,1,1000,1)
insert into inventory values(2,3,2000,1)
insert into inventory values(1,3,3000,2)
insert into inventory values(2,4,4000,2)
insert into purchase values(1,1,1200)
insert into purchase values(2,3,2300)
insert into inventory_temp(id,productid
select id,productid, quantity,dispatchtype from inventory  
where dispatchtype=1
now i want to show table inventory_temp like


but i dont want to use join i want to update my inventory_temp table
how can i do pleas help
Posted 19-Apr-13 19:31pm
Edited 19-Apr-13 23:01pm
gvprabu at 20-Apr-13 4:31am
Your Question is not clear... Give some more explanation about your problem.
srishti_ at 20-Apr-13 5:02am
This is solution

UPDATE inventory_temp
SET loaded_qnty = po.loaded_qnty
FROM purchase as po
Maciej Los at 20-Apr-13 7:01am
but i dont want to use join i want to update my inventory_temp table
Bernhard Hiller at 22-Apr-13 2:46am
Instead of a "temporary table", you should better use a View.
srishti_ at 22-Apr-13 2:58am
how to use view for this output pleasesend code........

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 KrunalRohit 356
1 OriginalGriff 335
2 CPallini 270
3 F-ES Sitecore 270
4 Sergey Alexandrovich Kryukov 234
0 OriginalGriff 2,950
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,735
4 Richard MacCutchan 1,157

Advertise | Privacy | Mobile
Web03 | 2.8.151002.1 | Last Updated 20 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100