Wednesday, 15 June 2011

sql - How to compare dates in Netezza? -



sql - How to compare dates in Netezza? -

i new learner in netezza. right now, wanna write sql statement feedback recent info objects corresponding defined recent date. homecoming info objects after 2014-06-10. or homecoming objects before date. homecoming info objects before 2014-03-10. how that? attribute in clause timestamp. assume simple process; however, cannot find it. give thanks in advance, guys!

you can compare date or timestamp field date created explicit phone call to_date function, or can compare character literal of date in format compiler recognize , implicitly cast date. example:

testdb.admin(admin)=> select * date_test; col1 --------------------- 2014-06-23 00:00:00 2014-06-22 00:00:00 2014-06-24 20:44:51 (3 rows) testdb.admin(admin)=> select * date_test col1 < '2014-06-23'; col1 --------------------- 2014-06-22 00:00:00 (1 row) testdb.admin(admin)=> select * date_test col1 < to_date('2014-06-23', 'yyyy-mm-dd'); col1 --------------------- 2014-06-22 00:00:00 (1 row)

sql netezza

No comments:

Post a Comment