And HAVING is really handy too if you wanted only the customers with a max date in a certain range you could add
HAVING MAX(date_of_sale) between .vDate1 AND .vDate2 Dennis McGrath [email protected] [email protected] On Mon, Dec 19, 2011 at 6:25 AM, Jim Belisle <[email protected]> wrote: > Bill, > > > > Thanks! That did the trick. I had never used MAX before. I just looked > at it as used for calculations. > > I knew the list would come through. > > > > James Belisle > > > > Making Information Systems People Friendly Since 1990 > > > > > > ________________________________ > > From: [email protected] [mailto:[email protected]] On Behalf Of Bill > Downall > Sent: Monday, December 19, 2011 6:10 AM > To: RBASE-L Mailing List > Subject: [RBASE-L] - Re: getting last row for all customers > > > > Jim, > > > > That's what MAX() and GROUP BY is for: > > > > SELECT customerid, MAX(date_of_sale) FROM orders GROUP BY customerid > > > > or > > > > CREATE VIEW LastSaleByCustomer (CustomerID, LastSaleDate) AS + > > SELECT customerid, MAX(date_of_sale) FROM orders GROUP BY customerid > > > > On Mon, Dec 19, 2011 at 6:55 AM, Jim Belisle <[email protected]> wrote: > > Using 7.6. > > I want to get all the distinct customer ids and the last date of sale > from the orders table. > > I see I cannot use the WHERE COUNT = LAST in a view. > > What command or function would I use? > > > > James Belisle > > > > Making Information Systems People Friendly Since 1990 > > > > > > > > > > >

