[thelist] sql filtering problem

Christopher Joseph Christopher at ideadesigners.com
Tue Aug 27 09:00:01 CDT 2002


> >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.

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

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

Thanks.

Sorry for the confusion regarding the term 'variant data' I meant 'data that
is not a known set of values' and NOT variant datatypes.

I agree the use of LIKE is warranted in a situation where the end user might
be responsible for entering the filter terms and situations like
CaPiTaLiZaTiOn occur but I couldn't determine from the original emailed code
whether or not wildcards were being used  (but then I cannot code in CF so I
wouldn't know my @rse from my elbow :)). Out of interest how is the wildcard
used in the original CF code?

Chris.






More information about the thelist mailing list