--- In php-list@yahoogroups.com, "j0hncage" <[EMAIL PROTECTED]> wrote:
>
> Realizing my original post might be rather 'excessive'  :-)
> 
> Can anyone tell me how to include "DISTINCT name" in the following? 
> I've tried numerous variations and haven't been able to make it work
> but think it must be possible.  I'm after a return of a single name
> where there may be a dozen or so 'Debra', only wanting it returned one
> time for counting purposes.  Thanks again for any help.  John
> 
> $query = "SELECT * FROM $table WHERE 1 = 1 ";
> if($month != "All") $query .= "and month = '".$month."'";
> if($year != "All") $query .= "and year = '".$year."'";
> if($name != "All") $query .= "and name = '".$name."'";
> 
> $result = mysql_query($query);
> 
> $number = mysql_numrows($result);
>

I believe it should be:

$query = "SELECT DISTINCTROW * FROM $table WHERE 1 = 1 ";


Reply via email to