Actually, the && is the same as "and". So it could be written as:
> mysql> select e.id,fname,sum(m.miles) from employees e > -> left join mileage m on m.id=e.id and month(trip_date)=3 > -> and substring(year(m.trip_date),3,2) = '02' > -> group by e.id; I'm just lazy...easier to hit & twice than type out "and". You were on the right path. You simply needed to move the conditional statements from the WHERE to the JOIN clause. I learned that stuff from reading the comments/answers on the list from DuBoise, Zawodny, and others. -----Original Message----- From: paul wilczynski [mailto:[EMAIL PROTECTED]] Sent: Friday, February 08, 2002 5:42 AM To: Rick Emery Subject: Re: [PHP-DB] Can't get left join to work Thank you! I'm obviously going to have to read up on that 'on ... &&' syntax - it's not something I'm familiar with. Paul Rick Emery wrote: > And the answer is: > > mysql> select e.id,fname,sum(m.miles) from employees e > -> left join mileage m on m.id=e.id && month(trip_date)=3 > -> && substring(year(m.trip_date),3,2) = '02' > -> group by e.id; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php