List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:January 19 2003 2:44pm
Subject:Re:SQL Count Query
View as plain text  
At 7:18 +0000 1/19/03, Nasser Ossareh wrote:
>  >a row gets inserted into this table
>whenever a visitor uses a certain tool on the site
>
>based on this approach your table does not have any entries for the 
>days that no one uses the certain tool on the site.  As a result 
>your query can not pull out records which don't exist.
>
>You could catter for this programmatically by a perl script.  The 
>script could do this:

That would work, but it's not necessary.  He should use a LEFT JOIN,
which will produce a row in the output for the left table, whether
or not any right table rows match it.  The syntax is in the MySQL manual.

>
>create a temporary table
>insert all records from your main table between TheStartDate and TheEndDate...
>iterate through TheStartDate and theEndDate and add one record per 
>day to the temporary table.
>The SQL statement should display count-1 for each day.
>
>I don't have perl on my system so I can't help with the script I 
>hope someone else can.
>
>-Nasser.

Thread
SQL Count QueryJefferey Donnici19 Jan
  • Re: SQL Count QueryHarald Fuchs19 Jan
Re:SQL Count QueryNasser Ossareh19 Jan
  • Re:SQL Count QueryPaul DuBois19 Jan
    • Re: Re:SQL Count QueryAdolfo Bello19 Jan
    • RE: SQL Count QueryJeff Donnici19 Jan
      • RE: SQL Count QueryPaul DuBois19 Jan
Re: SQL Count QueryJeff Donnici19 Jan
RE: SQL Count QueryJeff Donnici19 Jan