A bug has arisen in my code which has allowed duplicate entries to appear in a database table, but with different casing. I am using MySQL.
e.g In this example, the second row shouldn't have been added, but it was.
ID Name Description
-------------------------------------
1 HELLO WORLD Saying hello
2 Hello world Saying hello
To remedy the incorrect data, I want to delete the row where the full name is capitalised whereever a duplicate has occured. Can I do regex in SQL, is that the best solution, and how would I do it?
The table, in full, is as follows
'ADDRESSBOOK_GROUP', 'CREATE TABLE
ADDRESSBOOK_GROUP
(ID
int(10) unsigned NOT NULL default ''0'',NAME
varchar(255) collate utf8_unicode_ci NOT NULL,DESCRIPTION
text collate utf8_unicode_ci,ADDRESSBOOK_ID
int(10) default NULL,TYPE
int(10) unsigned NOT NULL default ''1'', PRIMARY KEY (ID
), KEYADDRESSBOOK_ID
(ADDRESSBOOK_ID
) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=DYNAMIC'
Edit - Also I forget to mention earlier that I only want the duplicate checks to occur when ADDRESSBOOK_ID is '6';