Forums

This topic is locked

Need help with a SQL query.

Posted 10 Jan 2003 21:29:01
1
has voted
10 Jan 2003 21:29:01 Tom Scott posted:
I have a table that help requests get submitted to. What I want is a SQL query in DWMX that tells me how many help requests have been submitted:

A: The current day
B: Past 7 days
C: Past 30 days

I got the current day to work by using the following code:

SELECT COUNT(*) AS Submitted_Today
FROM HelpDesk
WHERE DateSubmitted = DATE()

But how do I do the other 2? I'm using Access 97.

Thanks a lot, Tom

Replies

Replied 11 Jan 2003 12:38:33
11 Jan 2003 12:38:33 Owen Eastwick replied:
B:

SELECT COUNT(AnyField) AS Submitted_ThisWeek
FROM HelpDesk
WHERE DateSubmitted >= DateAdd(d, -7, DATE())


C:

SELECT COUNT(AnyField) AS Submitted_ThisMonth
FROM HelpDesk
WHERE DateSubmitted >= DateAdd(d, -30, DATE())



Regards

Owen.

<hr></hr>
Used programming books and web development software for sale (UK only):
www.tdsf.co.uk/Shop.htm

Multiple Parameter UD4 / Access 2000 Search Tutorial:
www.tdsf.co.uk/tdsfdemo/

Edited by - oeastwick on 11 Jan 2003 12:41:56

Reply to this topic