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


Herzlich
Werner

-- 
MySQL in Deutschland: Anpassung, Unterstützung, Schulung für Sie
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Dr. Werner Stürenburg <[EMAIL PROTECTED]>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Consultant
/_/  /_/\_, /___/\___\_\___/   Bielefeld, Germany
       <___/   www.mysql.com   +49-5224-997-407  Fax -409



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

Reply via email to