SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

noblemfd
Starting Member

Nigeria
18 Posts

Posted - 05/26/2012 :  04:31:50  Show Profile  Reply with Quote
Am developing an application with VB and MSSQL 2000. Database is JUTA and table is Inventory
The fields are InvDate, InvID, ShelfID, IN, OUT, Type. I want it in such a way that Whenever there is no opening balance in a particular shelf, it should insert a row and populate it with the data of the other shelf with the same InvID, but make the field β€˜IN’ to be zero(β€˜0’) and put its own shelf name.
For example, see Shelf1, Shelf2 and Shelf3 of Inv ID 000003. How do I do this.

EXPECTED OUTPUT
InvDate1 InvID IN OUT Bal Shelf Type
03/09/2000 000001 10 0 10 shelf1 BegBal
03/09/2000 000001 40 0 40 shelf 2 BegBal
03/09/2000 000001 30 0 30 shelf 3 BegBal
03/09/2000 000002 100 0 100 shelf 1 BegBal
03/09/2000 000002 0 0 0 shelf 2 BegBal
03/09/2000 000002 0 0 0 shelf 3 BegBal
04/09/2000 000001 35 0 35 shelf 1 D00001
04/09/2000 000001 20 0 20 shelf 1 D00001
04/09/2000 000002 50 0 50 shelf 3 D00001
06/09/2000 000003 0 0 0 shelf 1 BegBal
06/09/2000 000003 15 0 15 shelf 2 BegBal
06/09/2000 000003 0 0 0 shelf 3 BegBal

visakh16
Very Important crosS Applying yaK Herder

India
47069 Posts

Posted - 05/26/2012 :  22:14:53  Show Profile  Reply with Quote
where are you copying data from other shelf? As I see from above, values are all 0 for other shelfs with InvID 000003

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000