Hi Richard,
        I figured out what you did.  Not exactly what I am after.  College had 
a suggestion.  I am going to work on adjusting the structure to storing 
time/date as BIGINT and do the math on that.  I need to be able to adjust the 
interval as needed (depending on user request) and not have it fixed to 
position in a string.

Thanks,
Andrew S

-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Andrew 
Stewart
Sent: Wednesday, November 18, 2015 8:45 AM
To: 'SQLite mailing list' <sqlite-users at mailinglists.sqlite.org>
Subject: Re: [sqlite] 10 minute Avg

Hi Richard,
        That gave me 10 hour intervals not 10 minute.  Which is the part that 
controls the frequency?

Thanks,
Andrew S.

-----Original Message-----
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Richard Hipp
Sent: Wednesday, November 18, 2015 8:41 AM
To: SQLite mailing list <sqlite-users at mailinglists.sqlite.org>
Subject: Re: [sqlite] 10 minute Avg

On 11/18/15, Andrew Stewart <AStewart at arguscontrols.com> wrote:
> Hi,
>                 I am trying to generate 10 minute average data for a 
> day from a data set.  Table is created by the following:
>
> CREATE TABLE dataStreamRecord (fwParameterID INTEGER NOT NULL, 
> dateTime DATETIME NOT NULL, data INTEGER NOT NULL);
>
> Sample Data
> fwParameterID,dateTime,data
> 1074,2015-11-17 00:00:01,8192
> 1074,2015-11-17 00:33:18,0
>
> Any assistance in generating a query to do 10 minute averages for 
> 'data' on November 17 for fwParameterID 1074 would be appreciated.
>

Maybe this:

SELECT substr(dateTime,1,12)||'0:00:00', avg(date)
  FROM dataStreamRecord
 WHERE fwParameterID=1074
      AND dateTime BETWEEN '2015-11-17' AND '2015-11-18'
  GROUP BY substr(dateTime,1,12)
  ORDER BY 1;
--
D. Richard Hipp
drh at sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Notice: This electronic transmission contains confidential information, 
intended only for the person(s) named above. If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, distribution, 
or any other use of this email is strictly prohibited. If you have received 
this transmission by error, please notify us immediately by return email and 
destroy the original transmission immediately and all copies thereof.
_______________________________________________
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to