I want to exclude a timeframe (Friday 11 PM to Sunday 11 PM data) from my query

5 pts.
Tags:
I have a query to calculate TAT.I want to exclude records between Friday 11 PM to Sunday 11 PM from the query

Answer Wiki

Thanks. We'll let you know when a new response is added.

a generic answer – you say query so I assume the SQL language is involved –
almost all flavors of SQL have a function to determine day of week and they all have a date/time datatype –

so you want to use these capabilities to exclude certain rows

… WHERE …
AND NOT ( < — this will exclude rows that meet the following conditions
( DAY_OF_WEEK(date_column) = ‘FRIDAY’ < — this varies depending on DB2 or Oracle or MySQL or …
AND time_column > 23:00:00 )
OR
(DAY_OF_WEEK(date_column) = ‘SATURDAY’)
OR
(DAY_OF_WEEK(date_column = ‘SUNDAY’
AND time_column < 23:00:00)

caveat – be very careful if you specify 11PM – do you really want 10:59:59 PM or 11:00:01 PM ?

Steve

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Do you want to exclude that timeframe for all weeks ? What database are you using ?
    69,160 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following