Re: Datetime comparison & arithmetic
Posted in 2000
From: Christian Brauer <Christian.Brauer@Dresdner-Bank.com> > >I don't find any acceptable solution for the following query: > >table mytable (has lots of data, structure cannot be changed anymore >!) >a_date DATE, >a_time DATETIME HOUR TO SECOND, >a_key INTEGER, >stuff CHAR(...) > >I'd like to retrieve some data ordered by point of time (given in >following >pseudo-code): >SELECT Who_Can_Help_To_Combine(a_date, a_time), key >FROM mytable >ORDER BY 1 > > >The following solutions came to my mind: >- use a stored procedure which uses string buffers an datetime >conversion >- use a temporary table in some way to combine the two date/datetime >value > >Does anyone know an STRAIGHT method to convert a_date,a_time to >a_datetime >(perhaps using EXTEND,DATETIME,UNITS,MDY....) in my single select ? > >Any help (except supposing the 2 "solutions" mentioned above) or >funny comments (hi Clown) are really welcomed... Not funny, but: 1. Set DBDATE=YMD4- 2. SELECT a_date || " " || a_time, a_key, stuff FROM table ORDER BY 1 Should do it. I think. I haven't tested it. :) ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com