|
|
|
|
|
|
| Re: Updates by Week [message #577688 is a reply to message #577686] |
Tue, 19 February 2013 12:17   |
Solomon Yakobson
Messages: 1404 Registered: January 2010
|
Senior Member |
|
|
SerenityNetworks wrote on Tue, 19 February 2013 13:06Is this correct?
Close, but no cigar. Think what would happen if you have data for multiple years. Think why you were suggested TRUNC, not TO_CHAR (although you could use TO_CHAR, but with more date format elements).
SY.
[Updated on: Tue, 19 February 2013 12:19] Report message to a moderator
|
|
|
|
| Re: Updates by Week [message #577692 is a reply to message #577688] |
Tue, 19 February 2013 12:33   |
 |
SerenityNetworks
Messages: 8 Registered: February 2013 Location: Richardson, TX
|
Junior Member |
|
|
Yes, I discovered that once I noticed that I had data for 53 weeks and this is only February.
I added the where clause shown below and that got me what I needed.SELECT TO_CHAR(mt.date_modified,'IW') AS "Week", COUNT(*) AS "Updates"
FROM mytable mt
WHERE TRUNC (mt.date_modified) >= to_date('01-JAN-2013','dd-MON-YYYY')
GROUP BY TO_CHAR(mt.date_modified,'IW')
ORDER BY 1 ASC;
But examining your note I see that I don't need the TO_CHAR at all and the following would be better. Did this get me the cigar?SELECT TRUNC(mt.date_modified,'IW') AS "Week", COUNT(*) AS "Updates"
FROM mytable mt
GROUP BY TRUNC(mt.date_modified,'IW')
ORDER BY 1 ASC;
|
|
|
|
|
|
|
|
| Re: Updates by Week [message #577701 is a reply to message #577696] |
Tue, 19 February 2013 13:38  |
 |
BlackSwan
Messages: 20109 Registered: January 2009
|
Senior Member |
|
|
you can install VirtualBox on any Windows system; then use pre-configured VM that already contains Oracle DB.
You could an Oracle DB working on your PC in under 30 minutes!
|
|
|
|