[code]CREATE TABLE IF NOT EXISTS group ( user_id varchar(50) DEFAULT NULL, id bigint(255) NOT NULL, number varchar(15) DEFAULT NULL, group varchar(500) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
–
[/code]
I want that if there is duplicate entry with the same user_id & number & group it’s removed.
what would the best way to do this with the table?
best way, instead of removing the dupes, is preventing them from happening –
ALTER TABLE `group`
ADD UNIQUE INDEX ( user_id, `number`, `group` )
by the way, GROUP is a reserved word, i suggest you rename the table as well as the column