hello,
This is the table schema that i have:
CREATE TABLE TEST
(
COL1 NUMBER NOT NULL,
START_TIME DATE NOT NULL,
DURATION NUMBER,
COL2 NUMBER,
CONSTRAINT PK_TEST PRIMARY KEY
(
COL1,
START_TIME
)
This is the query i have to select all the rows within a time range:
SELECT
f.col2,
TRUNC(f.START_TIME,'DD'),
FROM test f
WHERE
(f.START_TIME >= TIMESTAMP '2007-04-13 00:00:00' AND f.START_TIME < TIMESTAMP '2007-07-20 00:00:00' )
GROUP BY
TRUNC(f.START_TIME,'DD')
If I want to exclude certain days, say Wednesday and Friday, how would the query be??
If I want to exclude certain hours, say the 3rd, 4th, 5th hour of the day and 23rd hour of the day(i.e, excluding 2am - 5am and 10pm - 11pm). Is it possible for me to provide just the list of hours i want to exclude, like [3,4,5,23] or do i need to give the range specifically?
Could you please tell me how the queries would be for the above cases. The hours and days to be excluded can vary, so the query shouldnt be specific for the numbers i have used.
Software/Hardware used:
ASKED:
June 12, 2008 4:41 AM
UPDATED:
June 17, 2008 8:55 PM
To exclude certain hours I would use the same approach as the one I suggested for the days exclusion (i.e. the to_char function).
For example:
To exclude the hours that Nida mentioned in the question, the condition should look like this:
-cadlg