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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

summary

Status
Not open for further replies.

ridhirao22

Programmer
Aug 27, 2010
140
US
Hi all,

I am trying to add sales and returns for a given date and unable to do so. Any Help is greatly appericated.
orderdate order# total returndate return# total
01-04-2011 123 196 1-11-2011 345 -45
01-04-2011 123 196 1-12-2011 456 -50
01-04-2011 231 298 2-01-2011 654 -100

How could I show this summed up the data for each date for date range:

Orderdate total returndate total

01-04-2011 494 1-11-2011 -45
01-04-2011 494 1-12-2011 -50
01-04-2011 494 2-01-2011 -100

I mean add order# 123 only once and not twice?
Hope could explain better!

TIA,
RR

 

Yes, you need to explain better because you have two return dates for order 123.
Which one you need to report?
[3eyes]



----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Possibly something like:

Code:
select order_date, order_no, sum(total) over
(partition by orderdate, order_no) total,
return_date, return_total
from orders

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top