Workaround Question

hyrican

New member
Local time
Today, 12:41
Joined
Oct 22, 2008
Messages
8
Hello,

I have a question about a query, here's the data:

Dataloggerkey Timestep
977 6
977 8
977 10
977 82
888 10
888 4
888 12

In the query I'd like to have:
Select dataloggerkey, SUM(Timestep)/(60*24) */to convert mins to days*/
From MDT
Where SUM(Timestep)/(60*24)<8 */to sort out only those dataloggerkey data where the total timestep is less than one week*/
Group by dataloggerkey;

Problem is I can't have an aggregate function in the where clause. Can you help me with a workaround? Or is the easiest way to tackle this to have this same query make a new table with a field that is SUM(Timestep)/(60*24) as Days and then sort that table by Days<8?

Thanks in advance.
 
Try

SELECT dataloggerkey, Int(Sum([timestep])/1440) AS ts
FROM MDT
GROUP BY dataloggerkey
HAVING ((Int(Sum([timestep])/1440))<8);

I used Int since you are only interested in whole days

Brian
 

Users who are viewing this thread

Back
Top Bottom