[thelist] sql filtering problem

Joshua Olson joshua at waetech.com
Tue Aug 27 08:41:01 CDT 2002


----- Original Message -----
From: "Christopher Joseph" <Christopher at ideadesigners.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, August 27, 2002 9:31 AM
Subject: RE: [thelist] sql filtering problem


> >The resultant SQL you want is:
>
> >SELECT Brand_Logo, Brand_Logo_sml, ID, Product_Type, Brand, Model,
> >Reference_No, Colour, image, Retail_Price, Delivery_Charge
> >FROM kitchen_appliance
> >WHERE Brand LIKE 'aeg' and Product_Type LIKE 'Microwave'
>
> Confused!
>
> Why would you use LIKE as a filter if your Brand and Product_Type columns
> are not going to contain variant data? i.e These columns should contain
> known values shouldn't they.

Technically you could use simple equality if the product type is known to be
100% correct and the CaPiTaLiZaTiOn is correct.  "aeg" is certainly not the
correct brand name.  It's more likely "AEG"--or something similar.  The LIKE
operator tends to be case-insensitive, which in this case could be a good
thing.  And, I also opted for LIKE in this case is because the code supplied
by Darren included references to the % (wildcard) token, which only makes
sense using LIKE.

Also, variant data has nothing to do with SQL really.  The LIKE is for
marking partial matches against strings.

Does this clear it up?

-joshua




More information about the thelist mailing list