Hi Paul,

I'm sure there are no spaces or other blank characters. I run exactly this query (I deleted the row and tried again):

INSERT INTO tab_p (d_id, name) VALUES (20602, 'Machico');
INSERT INTO tab_p (d_id, name) VALUES (20602, 'Funchal');

SELECT * FROM tab_p WHERE d_id = 20602 AND name LIKE 'Machico';
-> no results
SELECT * FROM tab_p WHERE d_id = 20602 AND name LIKE 'Funchal';
-> OK 1 row

SELECT * FROM tab_p WHERE d_id = 20602 AND name LIKE '%Machico';
-> OK 1 row

I really don't understand it. I have this problem with about 3 or 4 words within nearly 5000 that I currently have in the table.

Wenca

Paul Rhodes wrote:
Hi Wenca,

Is it possible that you may a space at the beginning or end of the
string.

Try this to determine whether this is the case:
SELECT * FROM tab_p WHERE d_id = 20602 AND name LIKE '%Machico%'

If this works, try deleting and re-inserting the row.

I've had a similar situation in the past.

Hope this helps,
Paul


-----Original Message-----
From: Wenca [mailto:[EMAIL PROTECTED] Sent: 27 October 2005 10:56
To: mysql@lists.mysql.com
Subject: Record exists but not found - grrr


Hi all,

I've got a problem that I don't understand and that is driving me mad.

I have a table 'tab_p' with this structure:

name    type
---------------------------------------
p_id    mediumint(8) AUTOINCREMENT NOT NULL PRIMARY KEY
d_id    smallint(5)  NOT NULL
name    varchar(50)  NOT NULL

And unique index on (d_id, name).

ENGINE=MyISAM DEFAULT CHARSET=utf8
COLLATE utf8_slovak_ci or utf8_czech_ci

And there is a row with (for example) these data:
p_id    d_id    name
------------------------
953     20602   Machico

When I try query:
SELECT * FROM tab_p WHERE d_id = 20602 AND name LIKE 'Machico'
-> no results

So I try to insert the row:
INSERT INTO tab_p (d_id, name) VALUES (20602, 'Machico')
-> Error: #1062 - Duplicate entry '20602-Machico' for key 2

Why!!!???

There are thousands of records in the table an they work fine but then there occures some normal word (even with no special characters) and it behaves like this.

Can anyone help me?

I'm running MySQL 4.1.11 on Linux.

Thanks
Wenca


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to