Date Field Comparisions

  • Hi Experts

    I have the clarification in date comparision in previos dates , in One condition need To check Where my Typ_id is 01 and 02 Then date can be Applied the below logic Or else

    Date can be updated in Previous Dates

    Typ_id logic

    First_date < Second_date The condition is True then We need to compare the Second_date corresponding the First_date columns is greater then than we updated the First_date Else Second_date updated

    Find the Attachment

  • sqlfriends@sql.com (12/21/2012)


    Hi Experts

    I have the clarification in date comparision in previos dates , in One condition need To check Where my Typ_id is 01 and 02 Then date can be Applied the below logic Or else

    Date can be updated in Previous Dates

    Typ_id logic

    First_date < Second_date The condition is True then We need to compare the Second_date corresponding the First_date columns is greater then than we updated the First_date Else Second_date updated

    Find the Attachment

    Can you try to clarify what you are doing? I can't understand the logic here. Also, it will be helpful if you can post ddl, sample data and desired output. Please see the first link in my signature for best practices when posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

  • Hi Friends,

    Can any one help me in calculating past N hrs,past week,past7days,pastNdays,past2weeks,past14days,this month. Date should be compare with today and should automatically calculate the selected date.

    Thanks,

    Shobana

  • shobanapraveen (10/17/2013)


    Hi Friends,

    Can any one help me in calculating past N hrs,past week,past7days,pastNdays,past2weeks,past14days,this month. Date should be compare with today and should automatically calculate the selected date.

    Thanks,

    Shobana

    First, you really should post new questions in a new thread.

    Second, based just on your post, I am not sure what you are trying to accomplish.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply