944,131 Members | Top Members by Rank

Ad:
  • Oracle Discussion Thread
  • Unsolved
  • Views: 1842
  • Oracle RSS
Dec 5th, 2007
0

SQL Script help

Expand Post »
I've created a sql statement that I'm try get the number of messages that will expire during a certain time period. I'm looking to purge messages according to mm/dd/yyyy. I'm having a world of difficulty figuring the statement format out assistence would be appriciate.

SQL script:

select originationtime, expirationtime, ((TO_DATE('01/01/1970', 'MM/DD/YYYY')) + (originationtime/(86400000.0)) - (5.0/24.0)), ((TO_DATE('01/01/1970', 'MM/DD/YYYY')) + (expirationtime/(86400000.0)) - (5.0/24.0)) from messages

gives me the following:

originationtime expirationtime
dd/mm/yyyy hh:mm dd/mm/yyyy hh:mm

this will go on for 600,000 rows with different dates and times I need to obtain a count of the number of messages that with a expirationtime of say 06/29/2011 then do the same for messages with an expirationtime for 09/15/2007. Thanks...
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mcraighead is offline Offline
1 posts
since Dec 2007
Dec 9th, 2007
0

Re: SQL Script help

Don't you just need to group on expirationtime?

Something like
select expirationtime, count(expirationtime)
from messages
group by expirationtime;

This will give you a list of the distinct expirationtime and the amount of times they occur.

Of course you'd have to replace the expirationtime in the above statement with your calculation of how it's derived from the database.

Nige
Reputation Points: 13
Solved Threads: 9
Junior Poster in Training
Nige Ridd is offline Offline
51 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Oracle Forum Timeline: Compare subparts of a field over multiple rows
Next Thread in Oracle Forum Timeline: Passing XML file to SP





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC