On Fri, Dec 19, 2008 at 1:26 PM, KeidrickP <[email protected]> wrote:
>
> why are you using the wildcard for specific columns to be returned?
> I would use something like the following:
>
> select fname,lname where hobby like  'hoc%'
>
> This is of course assuming that you are using MS SQL or MS Access.
> As Charles mentioned earlier you are going against the rules of
> normalization, but if you use your current schema, this should work.
>
>>>
>>> > CUSTOMER
>>>
>>> > CustID  FName   LName       Hobbies
>>> >    1       Fred        Smith        Fishing, Rollerball, Hockey
>>> >    2       Sally       Jones        Sailing
>>> >    3       Brian       Wilson      Gliding, Sailing, Singing, Hockey
>>>

Your SQL of:
select fname,lname where hobby like  'hoc%'
won't work given the example table.

Your SQL is saying look for 'hoc%' from the beginning of the Hobbies
field.

You need to either use '%hoc%' or as pointed out earlier, fix the dam
schema and not have some (n)varchar field with arbitrary values that
you have to search with LIKE and possibly lose index usage.  If there
is an Index.

Jim

Reply via email to