Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rolling minus sum from start of antoher field

Status
Not open for further replies.

ciarra41

Technical User
Sep 11, 2006
116
US
I need to subtract fields (“MKT_TOTAL”-“OrgTotal”) in first record value (“MKT_TOTAL’) it will go all the way down like a rolling sum but minus. When the beginning total runs out it should show 0 instead of a minus number.

Table name= bus_sales
Goal:
BUSINESS_NAME UNID ORDID OrgTotal MKT_TOTAL PERIOD_DT
Locksmith 587700010001 5877000100016/16/2009 $2,000.00 $1,000.00 6/16/2009
Locksmith 587700010001 0003765655 $281.26 $718.74 7/24/2009
Locksmith 587700010001 0003765656 $281.26 $437.48 7/24/2009
Locksmith 587700010001 0003765657 $281.26 $156.22 7/24/2009
Locksmith 587700010001 0003765674 $539.00 $0.00 7/24/2009
Locksmith 587700010001 0003765675 $539.00 $0.00 7/24/2009
Locksmith 587700010001 0003767336 $0.88 $0.00 7/28/2009
Locksmith 587700010001 00072S2072 $400.00 $0.00 6/16/2010
 
Please explain the first line:

Locksmith 587700010001 5877000100016/16/2009 $2,000.00 $1,000.00 6/16/2009

Also, what is down, that is, what is the descending sort order unique key?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top