|
|
Question : Extracting earliest date
|
|
Hi, I was wondering if someone could help. i've got a database system that contains tables linked to Oracle via an ODBC connection. I'm trying to run a query that will look up the earliest date in a field. At the minute the date field of the required timestamp is stored as type varchar2 in Oracle and so becomes type text in Access. In Oracle the date is in the format 26.01.04, and so I've used the following code to help Access recognise the date by swapping "/" for "."
DateValue((Mid([HCB_ANTW]![ANTW_ERSTELLT_AM],1,2) & "/" & Mid([HCB_ANTW]![ANTW_ERSTELLT_AM],4,2) & "/" & Mid([HCB_ANTW]![ANTW_ERSTELLT_AM],7,4)))
The problem is that there are numerous instances of a particular timestamp, and I need to look up the earliest to allow me to gauge an accurate response time. I have tried a query simply using the Min function in the Total row, but just get a data type mismatch error. I was wondering if anyone had any ideas to get around this problem and allow me to look up the eariest date?
|
Answer : Extracting earliest date
|
|
can you to_date the varchar2 column before doing a min?
min(to_date(varchar2_column,mat>))
that way it will order by date and not by character string
I'm not sure why you would get a data type mismatch error from a min - it should work on all datatypes - can you check that all your other types match up ok?
|
|
|
|
|