Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Queryon elapsed time

Status
Not open for further replies.

matpj

Technical User
Mar 28, 2001
687
GB
Hi,
I have the following query that will give me a list of all 'problem calls' that are outstaning (i.e. status not = 'closed')

SELECT [Problem Tickets].[Problem Type], [Problem Tickets].Allocated, [Problem Tickets].[Problem Description], [Problem Tickets].Status, [Problem Tickets].Contact, [Problem Tickets].EV200_EVT_DESC, [Problem Tickets].Date, [Problem Tickets].Stand, [Problem Tickets].Customer, [Problem Tickets].[Caller Reference] AS Expr1
FROM [Problem Tickets]
WHERE ((([Problem Tickets].Status) Not Like 'Closed'))
ORDER BY [Problem Tickets].[Caller Reference];



I want to be able to get this same thing printed out, but with an extra criteria showing all outstangin calls that are over 3 hours old.

I have a 'Date' field in my 'Problem Tickets' table, so I need to check the time difference between the current system time, and the Date/Time in the Date field.
any ideas?
 
WHERE [Problem Tickets].Status != 'Closed'
AND [Problem Tickets].Date < dateadd(&quot;h&quot;,-3,now())

dateadd(&quot;h&quot;,-3,now()) adds -3 hours to the current date time.

I recommend changing &quot;Not Like&quot; to != (not equal) as it is more efficient. Terry

;-) He has the right to criticize who has the heart to help. -Abraham Lincoln

SQL Article links:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top