#>> #>> What I want to do is modify this SELECT statement so that the rows #>> returned do not go past a certain date. Let's call it dStopDate. #>> #>> If I have dStopDate = '2009-28-07' #> #>Did you mean '2009-07-28' ? #>
Yes. #>> for example, then the last row I want to return is #>07/24/2009, which #>> is the last week prior to my dStopDate. #>> #>> 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. #> #>Did you mean "<=" instead of "<" ? No. "<" is correct. I do not want to include the dStopDate. Just the dates 'up to' the dStopDate. Anyway, Olaf answered this for me on a newsgroup. Appears that what I must do is to do my test on the GROUPED data. Therefore, the solution is to remove the WHERE and replace it with HAVING after the GROUP BY in my statement. This solved that problem (and now exposed a whole new one!). Seems my GROUPED data has a slight flaw. While most of the rows contain a FRIDAY date, there are some that have THURSDAYS date because no data was available for that particular Friday. This is a problem, since I must have nothing but FRIDAY dates for each row no matter if the data stopped on Thursday. LOL!! Thanks. Rick _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users