niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Oracle
Comparing DATE with TIMESTAMP fields possible ?
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Dave
*nix forums Guru


Joined: 19 Feb 2005
Posts: 1725

PostPosted: Wed Feb 09, 2005 11:01 pm    Post subject: Re: Comparing DATE with TIMESTAMP fields possible ? Reply with quote

"George Dainis" <george.dainis@bluecorner.com> wrote in message
news:cue1up$k5b$01$1@news.t-online.com...
Quote:
In my database table there is a datetime column which can obviously
contain a timestamp
(in the format YYYY-MM-DD HH:MM:SS.NNN).

Now I want to get all those records which have a date of lets say
2005-02-03 regardsless of
their time value.

Ok, I could do this by statement like

SELECT * FROM MYTAB WHERE MYDATE >= '2005-02-03 00:00:00.000' AND MYDATE
= '2005-02-03 23:59.59.999'

but this is rather inconvenient. I feel that there must be a shorter
version like

SELECT * FROM MYTAB WHERE MYDATE = '2005-02-03 **:**:**.***'

or a built-in fuction like:

SELECT * FROM MYTAB WHERE datepartonly(MYDATE) = '2005-02-03'

How does this work?

George


rtfm to_date
Back to top
Dave
*nix forums Guru


Joined: 19 Feb 2005
Posts: 1725

PostPosted: Wed Feb 09, 2005 11:00 pm    Post subject: Re: Comparing DATE with TIMESTAMP fields possible ? Reply with quote

"George Dainis" <george.dainis@bluecorner.com> wrote in message
news:cue1up$k5b$01$1@news.t-online.com...
Quote:
In my database table there is a datetime column which can obviously
contain a timestamp
(in the format YYYY-MM-DD HH:MM:SS.NNN).

Now I want to get all those records which have a date of lets say
2005-02-03 regardsless of
their time value.

Ok, I could do this by statement like

SELECT * FROM MYTAB WHERE MYDATE >= '2005-02-03 00:00:00.000' AND MYDATE
= '2005-02-03 23:59.59.999'

but this is rather inconvenient. I feel that there must be a shorter
version like

SELECT * FROM MYTAB WHERE MYDATE = '2005-02-03 **:**:**.***'

or a built-in fuction like:

SELECT * FROM MYTAB WHERE datepartonly(MYDATE) = '2005-02-03'

How does this work?

George
Back to top
George Dainis
*nix forums beginner


Joined: 09 Feb 2005
Posts: 10

PostPosted: Wed Feb 09, 2005 9:13 pm    Post subject: Comparing DATE with TIMESTAMP fields possible ? Reply with quote

In my database table there is a datetime column which can obviously contain a timestamp
(in the format YYYY-MM-DD HH:MM:SS.NNN).

Now I want to get all those records which have a date of lets say 2005-02-03 regardsless of
their time value.

Ok, I could do this by statement like

SELECT * FROM MYTAB WHERE MYDATE >= '2005-02-03 00:00:00.000' AND MYDATE <= '2005-02-03 23:59.59.999'

but this is rather inconvenient. I feel that there must be a shorter version like

SELECT * FROM MYTAB WHERE MYDATE = '2005-02-03 **:**:**.***'

or a built-in fuction like:

SELECT * FROM MYTAB WHERE datepartonly(MYDATE) = '2005-02-03'

How does this work?

George
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 2:39 am | All times are GMT
navigation Forum index » Databases » Oracle
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Problem with Date::Manip Ted Byers Perl 1 Fri Jul 21, 2006 4:23 am
No new posts Last login date Evan Ehrenhalt Server 1 Thu Jul 20, 2006 10:07 pm
No new posts How to query on part of a date column? Barry Newton MySQL 4 Thu Jul 20, 2006 5:02 pm
No new posts Question on comparing to variables containing integers huub Perl 14 Thu Jul 20, 2006 11:02 am
No new posts timestamp and calculations. Thor Tall PostgreSQL 2 Thu Jul 20, 2006 9:16 am

Internet Advertising | McDonalds | Loans | Free Ringtones | Cash Advance Loan
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1123s ][ Queries: 20 (0.0392s) ][ GZIP on - Debug on ]