User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 391,571 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,683 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser:
Views: 860 | Replies: 1
Reply
Join Date: Dec 2007
Posts: 1
Reputation: mcraighead is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mcraighead mcraighead is offline Offline
Newbie Poster

SQL Script help

  #1  
Dec 5th, 2007
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...
Milton C. Craighead, Jr.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Posts: 51
Reputation: Nige Ridd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 9
Nige Ridd Nige Ridd is offline Offline
Junior Poster in Training

Re: SQL Script help

  #2  
Dec 9th, 2007
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
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Oracle Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Oracle Forum

All times are GMT -4. The time now is 10:18 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC