RE: datetime calculation

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: p (p_at_discussions.microsoft.com)
Date: 02/04/05


Date: Fri, 4 Feb 2005 12:39:01 -0800

Used Northwind DB as an example:

Declare @OrderDate datetime

Set @OrderDate = '7/4/1996'

Select p.ProductName, o.OrderDate
>From Products p
Inner Join [Order Details] od On p.ProductID = od.ProductID
Inner Join Orders o On od.OrderID = o.OrderID
--Where o.OrderDate = '7/4/1996'
Where o.OrderDate = DateAdd(dd, 1, @OrderDate)

"seeker53" wrote:

> I have a datetime field in a SQL SERVER and I need to know clients that are
> scheduled for the next day when reading the info on the current day. I have
> tried
>
> [tblevent].[begin_datetime] = dateadd(d,1,getdate())
>
> within the where clause and this does not return any records. I know that
> the records exist because when I run [tblevent].[begin_datetime] = '2/5/05'
> many records return. I have also tried
>
> [tblevent].[begin_datetime] = getdate() + 1
>
> which also returns no records. How is the best way to solve this problem.



Relevant Pages

  • Re: Should be simple but....
    ... FROM Customers C ... INNER JOIN ORDERS O ... INNER JOIN [ORDER DETAILS] OD ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL to Linq - Left, Right and Inner Joins
    ... I'd certainly hope that the query optimiser would do the job there though. ... if the where clause is on an indexed column I'd be *hugely* surprised if the inner join were fully evaluated by SQL server before looking at the index. ... select distinct c.* from customers c inner join orders o ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Multiple Joins Using DAO
    ... Try building the query through the query builder and looking at the SQL ... FROM Employees INNER JOIN (Orders INNER JOIN ON ... FROM Employees INNER JOIN Orders INNER JOIN ON ...
    (microsoft.public.access.formscoding)
  • Re: SQL Question
    ... SQL solution given, but when running the program, i get the following error: ... INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID ...
    (microsoft.public.vb.general.discussion)
  • Re: SQL Question
    ... SQL solution given, but when running the program, i get the following error: ... INNER JOIN Orders ON OrderItem.OrderID = Orders.OrderID ... INNER JOIN Product ON OrderItem.ProductID = Product.ProductID ...
    (microsoft.public.vb.general.discussion)