Now that I have the grouping issue solved I need to combine multiple
selects into one cursor. I'll start another thread unless I find the
answer right away.
Joe
1) As mentioned above, this select retuns an error
unless expressed with SET ENGINEBEHAVIOUR 70.
Is it a good way to implement something without
considering today's sql standards ?
2) It is not mandatory to do everything in a single query,
(we are no longer like contesting for compact APL code).
3) Using UDF in a joining WHERE clause will slow down.
My idea :
[/VFP]
m.TSref = DATETIME()
m.intval = 60 && or 3600 or whatever
CREATE CURSOR joe (Stamp T, Value n(4))
FOR nn = 1 TO 100000
INSERT INTO joe VALUES (m.TSref + nn, 1000*RAND())
NEXT
CREATE CURSOR Moe (Stamp T, Value n(4))
FOR nn = 1 TO 100000
INSERT INTO moe VALUES (m.TSref + nn, 1000*RAND())
NEXT
***** install periods (lol)
SET ENGINEBEHAVIOUR 90
SELECT INT((stamp - m.tsref) / m.intval) as period,;
* FROM joe INTO CURSOR cjoe
SELECT INT((stamp - m.tsref) / m.intval) as period,;
value FROM moe INTO CURSOR cmoe
*** final query
SELECT tt.*,uu.stamp ;
FROM ;
(SELECT cjoe.period,AVG(cjoe.value) as joe,;
AVG(cmoe.value) as moe ;
FROM cjoe,cmoe ;
WHERE cjoe.period = cmoe.period ;
GROUP BY cjoe.period) tt ;
JOIN ;
(SELECT MIN(xx.stamp) as stamp,xx.period ;
FROM cjoe xx ;
JOIN ;
(SELECT period FROM cjoe GROUP BY period) yy ;
ON xx.period = yy.period ;
GROUP BY xx.period) uu ;
ON tt.period = uu.period
[/VFP]
Gérard.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/694A6572B8B7418F9AE2B71FB5EF6186@MuriellePC
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.