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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Need help on stock export

Author  Topic 

dyckwal
Yak Posting Veteran

58 Posts

Posted - 2005-10-19 : 05:22:25
Hello everyone
I have the following.

Have a table Item_Inbound containing

Item_Code, Units, Sub_Units, Status

Need to create a new table ExportStock containing

Item_Code, StockFree, StockBlocked

Example

Item_Inbound
Item_Code Units Sub_Units Status
A1200 100 10 1
A1200 50 10 1
A1200 100 10 2
B1300 80 20 1
C1400 60 12 2

The table ExportStock should like

Item_Code StockFree StockBlocked
A1200 1500 1000
B1300 1600 0
C1400 0 720

I'm looking for a one stop solution to get from one table to the other...

Can someone help me???

Thanks

Walter

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-19 : 05:27:07
What is your expected result?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

dyckwal
Yak Posting Veteran

58 Posts

Posted - 2005-10-19 : 05:50:05
Example

Item_Inbound
Item_Code Units Sub_Units Status
A1200 100 10 1
A1200 50 10 1
A1200 100 10 2
B1300 80 20 1
C1400 60 12 2

The table ExportStock should like

Item_Code StockFree StockBlocked
A1200 1500 1000
B1300 1600 0
C1400 0 720
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-19 : 06:01:52
I think you need Cross Tab
Refer this
http://weblogs.sqlteam.com/jeffs/archive/2005/05.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

dyckwal
Yak Posting Veteran

58 Posts

Posted - 2005-10-19 : 07:35:50
Thanks for the tip madhivanan.
Found a simelair solution like the crostab procedure described.

Thanks again..

Walter
Go to Top of Page
   

- Advertisement -