List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:June 8 2001 3:13am
Subject:Re: Mysql SQL behaviour with a plus sign
View as plain text  
In the last episode (Jun 07), ecotaj@stripped said:
> It looks like mySQL is funny about a + next to a - in a string.
> 
> 
> If I do select count(*) from Table where Column like '%+---%'
> I get 0 records.
> If I do select count(*) from Table where Column like '%---%'
> I get 70652 records.
> 
> How can I make it insensitive to a +-

Maybe you have 70652 records with "---" in them, and none with "+---" ?
It works fine in 3.23.38:


    Your MySQL connection id is 2451 to server version: 3.23.38-log

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer

    mysql> create table test ( field char(50) ) ; 
    Query OK, 0 rows affected (0.86 sec)

    mysql> insert into test values ("aaa----bbb"),("aaa+---bbb");
    Query OK, 2 rows affected (0.00 sec)
    Records: 2  Duplicates: 0  Warnings: 0

    mysql> select * from test;
    +------------+
    | field      |
    +------------+
    | aaa----bbb |
    | aaa+---bbb |
    +------------+
    2 rows in set (0.01 sec)

    mysql> select count(*) from test where field like '%+---%';
    +----------+
    | count(*) |
    +----------+
    |        1 |
    +----------+
    1 row in set (0.01 sec)

    mysql> select count(*) from test where field like '%---%'; 
    +----------+
    | count(*) |
    +----------+
    |        2 |
    +----------+
    1 row in set (0.01 sec)

    mysql>  


-- 
	Dan Nelson
	dnelson@stripped
Thread
Mysql SQL behaviour with a plus signecotaj7 Jun
  • Re: Mysql SQL behaviour with a plus signDan Nelson8 Jun