List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 7 2003 2:31am
Subject:Re: Selecting long string with non alpha's
View as plain text  
At 17:40 -0700 5/6/03, Scott Haneda wrote:
>I am having some trouble, mysql 3.2
>
>I have a database that stores email messages, I am trying to allow searching
>on the subject, and also pull up all related messages in the "thread" as
>well.
>
>I first grab the full subject as a string, and then search on that...
>
>SELECT id, name FROM listmail WHERE subject LIKE "%can anyone help? - if i
>use appendheader, my templates have too many headers!%" ORDER BY date_time
>ASC
>
>That exact subject exists in the database, but I can not find it if I search
>on that exact string...
>
>mysql> SELECT id, date_time, subject, name, email FROM listmail WHERE
>subject LIKE "%an anyone help? - if I use appendheader, my templates have
>too many headers
>s%" ORDER BY date_time DESC LIMIT 40;
>Empty set (0.13 sec)

I don't understand what you are trying to demonstrate.  In the first
query, the string ends with "...headers!%" and in the second it ends
with "...headerss%".  I wouldn't expect the second query to retrieve
the rows you're looking for.

>
>However, this
>mysql> SELECT id, name
>     -> FROM listmail
>     -> WHERE subject
>     -> LIKE "%can anyone help%if i use appendh%aders!%"
>     -> ORDER BY date_time ASC  LIMIT 0 , 30;
>+-------+--------------+
>| id    | name         |
>+-------+--------------+
>| 10110 | Steven       |
>| 10111 | Scott Haneda |
>| 10112 | Steven       |
>+-------+--------------+
>Yields the correct results, I don¹t understand this behavior at all.


-- 
Paul DuBois
http://www.kitebird.com/
sql, query
Thread
SELECT problemStikirana Yuana7 May
  • removing duplicate rowsBruce Douglas7 May
  • Selecting long string with non alpha'sScott Haneda7 May
    • Re: Selecting long string with non alpha'sPaul DuBois7 May
      • Re: Selecting long string with non alpha'sScott Haneda7 May
  • Re: SELECT problemStikirana Yuana7 May
    • Re: SELECT problemPaul DuBois7 May
Re: removing duplicate rowsJames Moe7 May