Solved

previous date

Posted on 2011-02-10
2
222 Views
Last Modified: 2012-05-11

I want to get only previoudate from mytable1. Orderdate is datetime
select orderdate, amount_ordered from mytabl1 where orderdate is the previousdate
0
Comment
Question by:VBdotnet2005
  • 2
2 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 125 total points
ID: 34867034
It should be something like:

select orderdate, amount_ordered
from mytabl1
where orderdate < CAST(getdate() as DATE)
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 34867050
Or:

select orderdate, amount_ordered
from mytabl1
where CAST(orderdate as DATE) = DATEADD(day,-1,CAST(getdate() as DATE))
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.

920 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

16 Experts available now in Live!

Get 1:1 Help Now