Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8818827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:12:11+00:00 2026-06-14T05:12:11+00:00

I have a Calendar table. I would like get 2 business before Today’s Date

  • 0

I have a Calendar table. I would like get 2 business before Today’s Date while skipping Holidays and weekeends.

For example:

Example 1: New years 2013 falls on a Tuesday. If it was Thursday (1/3), then my starting date would be Monday (12/31).

Example 2: If it was Monday (12/31), then my starting date would be Thursday (12/27).

My Clandar table as been prepopulated with 30 years worth of dates and have flags to determine which ones are weekend and hollidays. The table has these fields:

dt: Date and time for 30 years
Y: year
D: Day
M: Month
Isholiday: (Is a holiday are not, flagged with 0 for “no” and 1 for “Yes”)
IsWeekday: (Is a weekday? Flagged with 0 for “no” and 1 for “Yes”
HolidayDescritption: Holiday Names

Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:12:12+00:00Added an answer on June 14, 2026 at 5:12 am

    This is what you want :

    select top 1 *
      from ( select * 
               from Calendar 
              where IsHoliday = 0 
                and IsWeekday = 1 
                and dt between DateAdd( Day, -6, GetDate ) and GetDate() 
           ) tmpCalendar
     where dt <= DateAdd( Day, -2, GetDate() )
     order by dt desc
    

    Make sure to replace * with only the fields that you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Calendar of Events table and I would like to select events
I would like to ask if I have a table of events on my
I would like to have my articles counted per day in certain date period,
I have a calendar table in my MYSQL database with one field named datefield
I have a calendar table with data from year 2000 to 2012 (2012 wasn't
I'm building a simple availability calendar with PHP and MySQL. I have a table
I have calendar in Qt. I want when user selects date, 14(Qint32) will be
I have a calendar on my website, generated in Perl using Template::Toolkit and Template::Plugin::Date
I have two great tables that I would like to use as foundation for
I have a table which lists all events on a debating calendar. Each row

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.