At 11:56 PM -0400 7/16/99, Charles Kirby wrote:
>I guess the real question that begs to be answered here is this...
>How can
>"SELECT * from friends where car like '%vol%' and starsign like '%'"
>retrieve only one record?? (Instead of the--obviously--two records).
>
>This must mean that "%" (in front of "vol") cannot have a zero-character
>value... it must mean it's a wildcard for "1 or more characters."
>
>Is this true?
No. "%" means zero or more characters. However, it won't match NULL.
So, writing something like:
WHERE col_name LIKE "%"
is equivalent to
WHERE col_name IS NOT NULL
I still don't understand the original question, though. :-)
>
>ck
>
>On Fri, 16 Jul 1999, Paul DuBois wrote:
>
>> At 12:42 AM +0100 7/17/99, Robert W. Castley @ Home wrote:
>> >HI,
>> >
>> >I hope some one out there can help me with a little problem :-
>> >
>> >
>> >Scenario :-
>> >
>> >Example ....
>> >
>> >I have a database in MySQL with the following example fields and example
>> >data in database test, tablename friends:-
>> >
>> >NAME STARSIGN CAR NICKNAME
>> >robert aquarius volvo bob
>> >richard audi dick
>> >edward aries ted
>> >christopher volvo
>> >
>> >Now when you issue SELECT * from friends I would retrieve 4 records.
>> >
>> >robert,aquarius,volvo,bob
>> >richard,NULL,audi,dick
>> >edward,aries,NULL,ted
>> >christopher,NULL,volvo,NULL
>> >
>> >If I issue SELECT * from friends where car = 'volvo' I would retrieve 2
>> >records.
>> >
>> >robert,aquarius,volvo,bob
>> >christopher,NULL,volvo,NULL
>> >
>> >However if I issue SELECT * from friends where car like '%vol%' and
>>starsign
>> >like '%' I would retrieve only one record
>> >
>> >robert,aquarius,volvo,bob
>> >
>> >
>> >Question :-
>> >
>> >How can I create my last SELECT statement above to retrieve the two records
>> >that have the CAR = volvo ?
>> >
>> >Any help or information would gratefully be recieved,
>>
>> I've seen the replies to this message, and I'm wondering what I'm
>> missing here:
>>
>> Your second query does what you want, so ...
>> Why are you asking how to do what you want?
>>
>> --
>> Paul DuBois, paul@stripped
>>
>> ---------------------------------------------------------------------
>> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
>> posting. To request this thread, e-mail mysql-thread7597@stripped
>>
>> To unsubscribe, send a message to the address shown in the
>> List-Unsubscribe header of this message. If you cannot see it,
>> e-mail mysql-unsubscribe@stripped instead.
>>
>>
--
Paul DuBois, paul@stripped