Rick Ratchford wrote:
> SELECT Date FROM MyTable GROUP BY Year, Week
>
> This creates a recordset that groups all my prices into 'weekly'
> prices. In other words, each row represents the High, Low, Close
> prices for each week, and the date is the FRIDAY DATE of that week.

If this happens, then only by accident. The value of Date reported for 
each group comes from an arbitrary row belonging to the group. There is 
no guarantee which row will be so chosen.

> However, by adding WHERE Date < '" dStopDate "' prior to GROUP BY...
> (and yes, assume Date and dStopDate are same format), my last record
> returned is actually 07/27/2009 (the day before my dStopDate) rather
> than my 'weekly' record of 07/24/2009.

You've truncated the last group short, so a different row from that 
"incomplete" group accidentally happened to be chosen.

Try

SELECT count(*), max(Date) FROM MyTable GROUP BY Year, Week

with and without WHERE clause. This might prove illuminating.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to