Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Datediff function problems

Author  Topic 

zerohour80
Starting Member

5 Posts

Posted - 2004-06-28 : 13:48:26
Having a problem using the datediff function in access. Below is my first select statement which puts the time and date together.
SELECT BatchCards.Formulation, [Formulation] & "-" & [Batch] AS Product, [Date] & " " & [Time] AS Date_Time, BatchCards.Adjustment
FROM BatchCards;

Then my next select statement uses the info from above to calulate the datediff in hours.
SELECT visq.Product, visq.Formulation, Sum(visq.Adjustment) AS SumOfAdjustment, DateDiff('h',Min([date_time]),Max([date_time])) AS datediffh
FROM visq
GROUP BY visq.Product, visq.Formulation;


What happens is I get a negative number on some of the datediff field. I think the problem is because I am putting together the time and date field. I think it's converting it to string and that's why I can't do a date diff on that new alais field. Can anyone help?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-28 : 13:54:15
Please post Access questions in the Access forum:

http://www.sqlteam.com/forums/forum.asp?FORUM_ID=3

Tara
Go to Top of Page
   

- Advertisement -