Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distinct selection for date data type.

Status
Not open for further replies.

SergueiGoumeniouk

Programmer
Dec 6, 2002
2
CA
Dear Experts,
It seams the DISTINCT instruction does not work for the DATE data. If I run
SELECT DISTINCT columnName FROM myTable;
for column of this type, I have a lot of output, not a single line, because the TIME part of these rows are different. Is it possible to suppress the analysis of the TIME part of the DATE data type (on a server or a client level) without using constructions like TO_CHAR(columnName, 'DD-MON-YY')?
Regards,
Serguei.
 
You may select trunc() from your table to select (distinct) only date part of the field.
DISTINCT does work with all types, but your dates are REALLY DISTINCT, even if they're displayed similarly due to "TRUNCATING" format mask (NLS_DATE_FORMAT). Regards, Dima
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top