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

query for getting yesterday date entry Expand / Collapse
Author
Message
Posted Friday, July 11, 2008 1:14 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, July 11, 2008 1:11 AM
Points: 10, Visits: 34
Hi

I am developing application using windows mobile 6 with vc++ and SQL CE 3.1

I have used query for getting yesterday date entry ..I am doing minus 1 from system date

and getting result. but the problem is that when the system date is 1st day of month or year.this query is not working.



so is there any other logic

hope for reply.



thanx

subodh
Post #532181
Posted Friday, July 11, 2008 1:54 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 1:43 AM
Points: 40,617, Visits: 37,083
Could you post the query that you are using?


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #532198
Posted Sunday, July 13, 2008 3:57 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, July 13, 2008 4:16 AM
Points: 3, Visits: 2
Could u post your Query then i will reply
Post #533101
Posted Monday, July 14, 2008 1:18 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, February 12, 2014 2:57 AM
Points: 376, Visits: 57
try this query,it works for me

select * from testdate where datepart(dd,date1)=datepart(dd,getdate())-1

so ,i hope this work for you



Post #533300
Posted Monday, July 14, 2008 5:23 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, December 18, 2014 4:43 AM
Points: 1,184, Visits: 2,680
I think this is what you need however without further info I cannot be sure:

 SELECT
*
FROM
sometable
WHERE
somedatecolumn >= dateadd(dd,datediff(dd,0,getdate()),-1)
AND
somedatecolumn < dateadd(dd,datediff(dd,0,getdate()),0)



--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

Post #533409
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse