Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Date Field Comparisions Expand / Collapse
Author
Message
Posted Friday, December 21, 2012 9:22 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, March 5, 2015 3:23 AM
Points: 67, Visits: 274
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


  Post Attachments 
untitled.bmp (15 views, 445.29 KB)
Post #1399485
Posted Friday, December 21, 2012 9:40 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:17 PM
Points: 14,099, Visits: 13,723
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1399497
Posted Thursday, October 17, 2013 12:15 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, November 16, 2013 2:05 AM
Points: 17, Visits: 46
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
Post #1505493
Posted Thursday, October 17, 2013 1:28 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 4:15 PM
Points: 21,570, Visits: 34,123
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.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1505504
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse