Different results with current_timestamp

SourMylk

Active Newcomer
Joined
Aug 4, 2011
Messages
10
Reaction score
0
Points
0
Hi all,

These 2 scripts give back different results:

With timestamp:
Code:
select distinct events.node_name, events.status, nodes.platform_name from events, nodes where events.node_name=nodes.node_name and events.status<>'Completed' 
and events.status<>'Future' and events.scheduled_start>current_timestamp-1 day

With date:
Code:
select distinct events.node_name, events.status, nodes.platform_name from events, nodes where events.node_name=nodes.node_name and events.status<>'Completed' 
and events.status<>'Future' and events.scheduled_start>'2012-03-28'

How could I get the timestamp one to work?
It's like it doesn't go back after midnight.
 
Hi

I thnk this will work

Change the last part to be

date(events.scheduled_start)>='2012-03-28'

Cheers
 
Hi,

My problem is that I want to use the current_timestamp, so I don't have to rewrite the date every time I want to use the script.
 
Hi

try this,

select distinct events.node_name, events.status, nodes.platform_name from events, nodes where events.node_name=nodes.node_name and events.status<>'Completed' and events.status<>'Future' and events.scheduled_start>='2012-01-01' and scheduled_start >= current_timestamp - 24 hours

Hope that helps
 
select distinct events.node_name, events.status, nodes.platform_name from events, nodes where events.node_name=nodes.node_name and events.status<>'Completed' and events.status<>'Future' and events.scheduled_start>='2012-01-01' and scheduled_start >= current_timestamp - 24 hours

This one works!
Thank you!
 
Back
Top