August 19, 2015 at 11:18 am
Try this:
declare @myDate datetime;
set @myDate = cast(dateadd(day, -1, getdate()) as date);
SELECT
*
FROM
[ThomasSci].[dbo].[tsi_gdserial_vw]
where
cast(date_shipped as date) = @myDate
order by
order_no desc,
order_ext asc
GO
August 19, 2015 at 11:21 am
Or this:
SELECT
*
FROM
[ThomasSci].[dbo].[tsi_gdserial_vw]
where
date_shipped >= cast(dateadd(day, -1, getdate()) as date) and
date_shipped < cast(getdate() as date)
order by
order_no desc,
order_ext asc
GO
August 19, 2015 at 11:23 am
worked like a charm. Thank you very much.
August 19, 2015 at 11:23 am
Or this:
declare @myDate datetime;
set @myDate = cast(dateadd(day, -1, getdate()) as date);
SELECT *
FROM [ThomasSci].[dbo].[tsi_gdserial_vw]
where date_shipped >= @myDate
AND date_shipped < DATEADD( dd, 1, @myDate)
order by
order_no desc,
order_ext asc
It's not a significant difference on what happens behind the scenes.
EDIT: Didn't see that Lynn already posted this type of query.
Viewing 4 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply