Subject | Re: SQL Query Help |
---|---|
Author | Adam |
Post date | 2005-11-17T00:27:42Z |
--- In firebird-support@yahoogroups.com, "Erik Raul Chan Silveira"
<echan@s...> wrote:
Unless there is something I am not considering, it looks like a
simple group by.
select ProductID, max(SaleDate) as LastSaledate
from WhateverYourTableIsCalled
group by ProductID
Adam
<echan@s...> wrote:
>recent)
> Hello People:
> (if this msg is a off topic, pardon me, point me to another list)
>
> I would like your help with a query, I have the next data:
>
> ProductID SaleDate (m/d/Y)
> Pr1 05/05/2005
> Pr1 06/01/2005
> Pr2 01/01/2005
> Pr2 10/15/2005
> ...
> Pr1 10/29/2005
> Pr2 10/16/2005
> ...
> Pr3 10/01/2005
> ...
>
>
> I wanna obtain a resulset with all products and its last (most
> SaleDate,a
> something like:
> ProductID SaleDate
> Pr1 10/29/2005
> Pr2 10/16/2005
> Pr3 10/01/2005
>
> may i accomplish it with one (maybe complex) query or should I make
> stored procedure?Erik,
Unless there is something I am not considering, it looks like a
simple group by.
select ProductID, max(SaleDate) as LastSaledate
from WhateverYourTableIsCalled
group by ProductID
Adam