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 |
|
tempus
Starting Member
47 Posts |
Posted - 2010-06-23 : 09:59:34
|
| hey guys, i need an example for:tableproduct_code product_quantity order_code raw_mat_code q_needed lot_no total_raw_mat_stocka1 100 601 mp1 10 xxx3 175b1 200 606 mp1 20 xxx1 175c1 500 602 mp1 15 xxx6 175d1 400 603 mp1 10 xxx9 175e1 300 605 mp1 5 xxx4 175f1 600 604 mp1 1 yyx4 175what i need is another column which will be total_raw_mat_stock-q_needed as:product_code product_quantity order_code raw_mat_code q_needed lot_no total_raw_mat_stock availb. a1 100 601 mp1 10 xxx3 175 165b1 200 606 mp1 20 xxx1 175 145c1 500 602 mp1 15 xxx6 175 130d1 400 603 mp1 10 xxx9 175 120e1 300 605 mp1 5 xxx4 175 115f1 600 604 mp1 1 yyx4 175 114i dont know how to do it. i need the method of calculus. last column is the difference between stock and needed , taking into consideration the last difference. there are many codes of raw_mat_code and also of the other columns. Thanks in advance everyone!edit - moved to correct forum |
|
|
tempus
Starting Member
47 Posts |
Posted - 2010-06-23 : 10:01:47
|
| please move to transact -SQL 2005 - sry for the mistake made! |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2010-06-23 : 10:27:47
|
| Search this site for "Running Total".http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|
|
|