Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run a query # of times in a given month?

Status
Not open for further replies.
Apr 19, 1999
9
0
0
US
Visit site
Is there anything in Oracle that will help me solve this problem? I have a query that I have to run for every day in the current month. The query is here, and say, for the month of July, I'd have to run it 31 times since July has 31 days in it, but I can't put numbers in the where clause, because come September or February, I'll get an error saying couldn't run query for the 31st day, etc. anyone have any ideas? I'm trying to get it to output how many lines of data there are for each day in the month. Thanks<br>
<br>
select count (*)<br>
from sorted<br>
where ddate = **Day1**;<br>
<br>
select count (*)<br>
from sorted<br>
where ddate = **Day2** etc.
 
Hi,<br>
<br>
I don't know if you expect only one field as result of your query, see if this helps you:<br>
<br>
Select count(*),ddate<br>
from sorted<br>
where to_char(ddate,'MMYYYY') = to_char(sysdate,'MMYYYY')<br>
group by ddate;<br>
<br>
this returns something like this:<br>
<br>
COUNT(*) DDATE<br>
--------- ---------<br>
8875 01-JUN-99<br>
7423 02-JUN-99<br>
7620 04-JUN-99<br>
7103 07-JUN-99<br>
10372 08-JUN-99<br>
7962 09-JUN-99<br>
<br>
<br>
Good Luck<br>
<br>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top