Discussion:
Min Question
(too old to reply)
Jeff
2007-11-29 01:29:05 UTC
Permalink
my data looks like the following

111 0 01/01/2007
111 0 02/01/2007
222 0 04/01/2007
222 0 05/01/2007
555 1 06/01/2007
666 0 06/01/2007

how can i retrieve the following???

111 0 01/01/2007
222 0 04/01/2007
555 1 06/01/2007
666 0 06/01/2007

my goal is to retrive distinct cols 1 and 2, and then the earliest date in
col 3 for distinct records in cols 1 and 2???

any suggestions??? I tried different ways of using min a, but was
unsuccessful. I can get max to work which returns the latest date, but when
i switch to min, I dont get any records.

Thanks in advance.
Alex B
2007-11-30 05:40:49 UTC
Permalink
sql statement should be along the lines of:

select col1, min(date)
from your_table
group by col1

Cheers,

A.
Post by Jeff
my data looks like the following
111 0 01/01/2007
111 0 02/01/2007
222 0 04/01/2007
222 0 05/01/2007
555 1 06/01/2007
666 0 06/01/2007
how can i retrieve the following???
111 0 01/01/2007
222 0 04/01/2007
555 1 06/01/2007
666 0 06/01/2007
my goal is to retrive distinct cols 1 and 2, and then the earliest date in
col 3 for distinct records in cols 1 and 2???
any suggestions??? I tried different ways of using min a, but was
unsuccessful. I can get max to work which returns the latest date, but when
i switch to min, I dont get any records.
Thanks in advance.
Loading...