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
>
SELECT * FROM friends WHERE car LIKE '%vol%' AND
(starsign LIKE '%' OR starsign IS NULL)
jim...