Yep, sure was the spaces....OMG...will I ever get it...
On 7/21/09 12:29 PM, "Ashley Sheridan" <a...@ashleysheridan.co.uk> wrote:
On Tue, 2009-07-21 at 13:24 -0400, Andrew Ballard wrote:
> On Tue, Jul 21, 2009 at 1:20 PM, Miller,
> Terion<tmil...@springfi.gannett.com> wrote:
> > Here it is...I see where it's doing the restaurant.name LIKE statement 2x
> > which is prob messing it up right...but in the code why is it doing that
> > twice..
> > SELECT name, address, inDate, inType, notes, critical, cviolations,
> > noncritical FROM restaurants, inspections WHERE restaurants.name <> '' AND
> > restaurant.ID = inspection.IDAND restaurants.name LIKE '%A%' AND
> > restaurants.name LIKE '%A%' ORDER BY restaurants.name;
> It's not the multiple LIKE statements. It is the concatenation, like I
> said the last time. There is no white space between "inspection.ID"
> and "AND".
> You may indeed have problems with some of those repeated conditions on
> restaurants.name, but if so they will be performance issues resulting
> from table scans, and not the errors you are reporting.
It's always better putting in extra whitespace at both ends of each part
of the query you are concatenating if you're unsure. Like Andrew said,
MySQL will balk if you have none between keywords, but I've never heard
it complaining about an extra space or two!
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php