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!

Need to get the only 1st order!

Status
Not open for further replies.

YA

Programmer
Aug 13, 2001
37
US
Hi. I need to get only the 1st order from each customer.

Here is the situation:

The report needs to show each customer with his/her 1st order. However, lots of customers have placed multiple orders already so (I think) I need to put a formula to exclude the orders but the 1st order...The order table has "Order Created On" date field and "Order Number" field that is generated by the database automatically (the lower the earlier).

Is there any way I can select only the 1st order by making good use of these fields?

Any idea will be appriciated!! Thanks!
 
try using the NthSmallest function eg;

NthSmallest({Order Number,1) the ',1' returns the smallest. NthSmallest({Order Number,2) would return second smallest etc;
 
Thanks BFAGG!

I ended up using the function like this:
NthSmallest(1, {Order_Number}, group)

It returns the smallest order number for each group.
Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top