| Author |
Topic  |
|
|
MageshkumarM
Yak Posting Veteran
India
61 Posts |
Posted - 02/08/2013 : 02:42:29
|
Hi all,
I hav a datas below mentioned
2010-01-01 JackSon 25.6 2010-01-02 Stack 230.1 2010-01-04 Steven 23.1 2010-01-05 Bell 2.11 2010-01-07 Clerk 30.1 2010-01-08 June 1.1
I'm try to find previous date, could please help me abt this.
|
|
|
MageshkumarM
Yak Posting Veteran
India
61 Posts |
|
|
madhivanan
Premature Yak Congratulator
India
22460 Posts |
Posted - 02/08/2013 : 02:52:00
|
where date_col>=dateadd(day,datediff(day,0,getdate()),-1) and date_col<dateadd(day,datediff(day,0,getdate()),0)
Madhivanan
Failing to plan is Planning to fail |
 |
|
|
MageshkumarM
Yak Posting Veteran
India
61 Posts |
Posted - 02/08/2013 : 03:40:30
|
sorry, where the condition check with date '2010-01-07'.
I'm not get the previous day date..
Thanks, Magesh.M http://mageshkumarm.blogspot.com/ |
 |
|
|
MageshkumarM
Yak Posting Veteran
India
61 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47037 Posts |
Posted - 02/08/2013 : 05:12:45
|
SELECT Datefield AS YourDate,t1.PrevDate AS PreviousDate
FROM YourTable t
OUTER APPLY (SELECT MAX(DateField) AS PrevDate
FROM YourTable
WHERE datefield < t.Datefield)t1
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
MageshkumarM
Yak Posting Veteran
India
61 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47037 Posts |
Posted - 02/08/2013 : 05:55:23
|
welcome
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
| |
Topic  |
|