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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please help Informix Datetime

Status
Not open for further replies.

jsgoober

Programmer
Jan 3, 2002
12
US
Hi All,

What I have is a field called transtime (datetime year to second)m i.e., YYYY-MM-DD HH:MM:SS.

What I would like to know how to SELECT/RETRIEVE is
any records/rows that have 45 mins older than current
time. In other words, if my transtime is 45 mins past,
I would like to display them.

Thanks for the help.

 
Hi:

a way to do it. Given a table:

create table test_tab (
dt datetime year to second
};

Run this from dbaccess:

select current year to second + interval(45) minute to minute dt from systables
where tabname = "systables"
into temp b;

select * from test_tab where dt > (select dt from b);
# end sql

The above creates a temp table with a datetime column with one entry where current datetime has 45 minutes added to it.

Perform another select where the value in the temp table is used in a subselect.

Regards,

Ed
 
Thanks for the help. However, I found the solution
I was looking for. The way I wanted is as follows:
SELECT * from tablename
WHERE transtime <= current - interval(45) minute to minute;

Anyways, thanks for your time and response.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top