select statement by weeks

Posted on 2010-01-04
Last Modified: 2012-05-08
@Week-4 = t.FriTheWeek

I have a select statement, I just encounter this error for the New year. This is calculated by weeks.
But as you see above i have @Week -4 weeks. But it shows me -3 in the results how can i tell it to if
if minus or less than one week the start from week 52 then go back.

Question by:sevensnake77
    LVL 15

    Expert Comment

    post your sql query and code here
    LVL 19

    Accepted Solution

    something like

    case when @Week-4 <0 then 52+(@week-4) else @week-4 end = t.FriTheWeek
    LVL 9

    Author Closing Comment

    LVL 51

    Expert Comment

    try this

    ((52 + @Week - 4) % 52) = t.FriTheWeek

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now