--- Werner Stürenburg <[EMAIL PROTECTED]> wrote:
>
>
> Calvin Xu schrieb am Donnerstag, 23. August 2001,
> 03:16:09:
>
> > select
> subject,subhead,subsubhead,data2,data3,see_also
> > from npl_detail where ( (subject like '% asia %'
> OR
> > subhead like '% asia %' OR subsubhead like '% asia
> %'
> > or data2 like '% asia %' or data3 like '% asia %'
> or
> > see_also like '% asia %')) AND NOT (subject like
> > '%winter%' OR subhead like '%winter%' OR
> subsubhead
> > like '%winter%' OR data2 like '%winter%' OR data3
> like
> > '%winter%' OR see_also like '%winter%') ORDER BY
> > subject, subhead, subsubhead desc limit 0, 15
>
> > But if I shorten some OR condition with NOT(),
> some
> > results would return.
>
> The query looks fine to me. I would investigate if
> the result is
> not correct, i.e. you don't have any record that
> complies to the
> constraint.
>
> But also consider, if you don't want to ask for
>
> select
> subject,subhead,subsubhead,data2,data3,see_also
> from npl_detail
>
> where (subject like '% asia %'
> AND NOT subject like '%winter%')
> OR
> (subhead like '% asia %'
> AND NOT subhead like '%winter%')
> OR
> (subsubhead like '% asia %'
> AND NOT subsubhead like '%winter%')
> OR
> (data2 like '% asia %'
> AND NOT data2 like '%winter%')
> OR
> (data3 like '% asia %'
> AND NOT data3 like '%winter%')
> OR
> (see_also like '% asia %'
> AND NOT see_also like '%winter%')
>
> ORDER BY
> subject, subhead, subsubhead desc
> limit 0, 15
>
THanks for the kind reply. The above statement still
doesn't return any result. However, if I change it to
as follows, it will return results:
select subject,subhead,subsubhead,data2,data3,see_also
from npl_detail
where (subject like '% asia %'
AND subject NOT like '%winter%')
OR
(subhead like '% asia %'
AND subhead NOT like '%winter%')
OR
(subsubhead like '% asia %'
AND subsubhead NOT like '%winter%')
OR
(data2 like '% asia %'
AND data2 NOT like '%winter%')
OR
(data3 like '% asia %'
AND data3 NOT like '%winter%')
OR
(see_also like '% asia %'
AND see_also NOT like '%winter%')
ORDER BY
subject, subhead, subsubhead desc
limit 0, 15
Logically, there is no difference between this and the
one you gave me. MySql is new to me. Does it mean any
difference in MySQL? I am trying more changes.
Thanks.
Calvin
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php