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
>
>
>
>
>
>
>
>

Reply via email to