Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Distinct not working when convert DATE using TO_CHAR

Re: Distinct not working when convert DATE using TO_CHAR

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 21 Dec 2005 09:06:42 -0800
Message-ID: <1135184787.39995@jetspin.drizzle.com>


SunScreen wrote:
> Following is the data:
>
> Number Date
> ---------- -------------------
> 26 12/19/2005 13:57:05
> 26 12/19/2005 13:57:07
> 27 12/19/2005 13:57:29
> 27 12/19/2005 13:57:31
> 28 12/19/2005 13:57:54
> 28 12/19/2005 13:57:55
>
> and the actual query:
>
> select Field1 "Number", to_char(time, 'MM/DD/YYYY HH24:MI:SS') "Date"
> from audit_iedata where ( time >= to_date('19-DEC-2005 13:00',
> 'DD-MON-YYYY:HH24:MI') and time <= to_date('19-DEC-2005 14:00',
> 'DD-MON-YYYY:HH24:MI'));
>
> How can I get only first occurence of Field1 ? ie:
>
> Number Date
> ---------- -------------------
> 26 12/19/2005 13:57:05
> 27 12/19/2005 13:57:29
> ....

SELECT MIN() Also please run the following query and spend some serious time examining the result set.

SELECT keyword
FROM v$reserved_words;

Your query is a nightmare waiting to happen.

-- 
Daniel A. Morgan
http://www.psoug.org
damorgan_at_x.washington.edu
(replace x with u to respond)
Received on Wed Dec 21 2005 - 11:06:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US