How i implement a SQL instruction that makes this.
Posted on 2004-08-15
I need a SQL instruction that shows the AVERAGE sell price of the last 4 purchase of some client.
I am using this:
SELECT FIRST 4 * FROM books WHERE customer='JOEL' ORDER BY DATE_INC DESC
But with this, i just select the last 4 purchases of my client JOEL. How i show the AVERAGE sell price of these 4 last purchases?
P.S.: DATE_INC saves the date when the customer buy something. My price field called PRICE.
I deeply need it.