Hello,
This is my table structure:
CREATE TABLE IF NOT EXISTS `the_table_name` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(100) NOT NULL,
`phone` varchar(25) NOT NULL,
`nric` varchar(25) NOT NULL,
`address1` varchar(255) NOT NULL,
`gender` varchar(10) NOT NULL,
`race` varchar(10) NOT NULL,
`date` int(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
I want to concatenate name, phone, nric, address1 into a temporary column, identify the duplicate rows in that temporary column & delete those duplicate rows leaving only unique rows left.
For example, let’s say that after concatenation, the temporary column has got the following records:
michael, 12345678, 91011231314, baker street
james, 12345678, 91011231314, baker street
michael, 12345678, 91011231314, baker street
michael, 12345678, 91011231314, downing road
This record should be deleted:
michael, 12345678, 91011231314, baker street
These records should remain:
michael, 12345678, 91011231314, baker street
james, 12345678, 91011231314, baker street
michael, 12345678, 91011231314, downing road
How do I achieve this via a query?
Thanks for your help.