Help finding 7 days worth of records

Results 1 to 2 of 2

Thread: Help finding 7 days worth of records

  1. #1
    scrubz Guest

    Default Help finding 7 days worth of records

    I&#039;ve got a page that I want to display seven days worth of journal entries. My SQL string searches for dates between Now-7 and Now. It almost works, but if there was not an entry for one of the last seven days, it will only display six days of entries. <BR><BR>What&#039;s the best way to iterate through the results, and see how many days in the last week have entries? I thought about putting the dates into an array, searching for duplicates, getting a final count, and then modifying the search if there aren&#039;t seven days, but even this seems bloated. Keep in mind that any given day can have more than one entry, too. Any help is much appreciated. Code available if necessary. Thanks much.

  2. #2
    Join Date
    Dec 1969

    Default RE: Help finding 7 days worth of records

    Try executing this query and please let me know if this works at, I have never tried this but reading your question, just thought of giving it a shot:<BR>"select count(distinct("date")) mycount from tablename where date between(now and now-7)".<BR>--------------------------<BR>i wanna see if count(distinct("date")) works or not, between should work, it does with oracle at least.<BR>good luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts