[thelist] sql filtering problem

darren darren at web-bitch.co.uk
Tue Aug 27 08:42:00 CDT 2002


On Tuesday, August 27, 2002 at 14:31, Christopher Joseph wrote:

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

CJ> Confused!

CJ> Why would you use LIKE as a filter if your Brand and Product_Type columns
CJ> are not going to contain variant data? i.e These columns should contain
CJ> known values shouldn't they.

because you want it to return everything if you aren't filtering in any
way.  in that case you'd be matching on LIKE '%'.

i'd re-write the sql generation part so that the parameters aren't passed
in if you don't have values for them.  this is a simple way of having one
sql string get all the values or filtering the list as required.

hth,

darren




More information about the thelist mailing list