I'm trying to SEARCH for DISTINCT records in the database based upon a date field. For example, I want to group all records for July 26, 2001. Unfortunately the fields contain not only the date, but the time also. So when I run my query...
SELECT DISTINCT settle_dte FROM heloc_tracking WHERE settle_dte > TO_DATE('25.7.2001','DD.MM.YYYY') AND settle_dte < TO_DATE('27.7.2001','DD.MM.YYYY') ORDER BY settle_dte
...I get a result set of four different records with the same date but four different times.
SELECT DISTINCT trunc(settle_dte) FROM heloc_tracking WHERE settle_dte > TO_DATE('25.7.2001','DD.MM.YYYY') AND settle_dte < TO_DATE('27.7.2001','DD.MM.YYYY') ORDER BY settle_dte
SELECT DISTINCT trunc(settle_dte) FROM heloc_tracking WHERE settle_dte > TO_DATE('25.7.2001','DD.MM.YYYY') AND settle_dte < TO_DATE('27.7.2001','DD.MM.YYYY') ORDER BY trunc(settle_dte)
Or it could be yelling about the ORDER BY column not matching the SELECT? Wrap both in a trunc() and try again.
Bookmarks