date check in a select

2010-02-11 Thread Richard Rhodes
What's the best way to write a date check like this?I'm looking for any nodes registered after some number of days (the 30 is just an example). dsmadmc -se=$i -id=$adminid -password=$adminpwd -tab -noc EOD select node_name, reg_time from nodes where reg_time \ 30 days EOD ANR2916E

Re: date check in a select

2010-02-11 Thread Ian Smith
Richard, the column reg_time is in datetime format so you need to 'cast' it into the correct format. Further, you are comparing against an integer. What you probably want is: select node_name, date(reg_time) from nodes \ where cast(current_date - date(reg_time) as integer) 30 the first date()

Re: date check in a select

2010-02-11 Thread Michael Green
Try this: select node_name, reg_time from nodes where cast((current_timestamp-reg_time)days as decimal)30 -- Warm regards, Michael Green On Thu, Feb 11, 2010 at 6:46 PM, Richard Rhodes rrho...@firstenergycorp.com wrote: What's the best way to write a date check like this?    I'm looking for

Re: date check in a select [using days(...) function]

2010-02-11 Thread James R Owen
I use this variant: [?equivalent to M.Green's?] select node_name, reg_time from nodes- where days(current_timestamp)-days(reg_time)30 -- jim.o...@yale.edu (w#203.432.6693, c#203.494.9201, h#203.387.3030) Michael Green wrote: Try this: select node_name, reg_time from nodes where