I am currently doing the following join and it takes a very long time to execute the query, is there a way to make it run quicker? I have 23 fields in the table. I have a primary key on the field 'id' (int) 5 reg (varchar) 9
SELECT a1.*, ( SELECT COUNT(reg) FROM auction a2 WHERE reg = a1.reg) AS c1 FROM auction a1
CREATE TABLE IF NOT EXISTS `db1` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`adate` varchar(10) NOT NULL,
`lnu` int(4) NOT NULL,
`reg` varchar(9) NOT NULL,
`mk` varchar(50) NOT NULL,
`mod` varchar(50) NOT NULL,
`type` varchar(25) NOT NULL,
`ree` varchar(50) NOT NULL,
`co` varchar(50) NOT NULL,
`fu` varchar(20) NOT NULL,
`tran` varchar(20) NOT NULL,
`mt` varchar(9) NOT NULL,
`mile` int(6) NOT NULL,
`ree` int(6) NOT NULL,
`apv` int(6) NOT NULL,
`ds` int(2) NOT NULL,
`sr` varchar(50) NOT NULL,
`sen` int(10) NOT NULL,
`keep` int(2) unsigned NOT NULL,
`tmp` char(1) DEFAULT NULL,
`rk` varchar(100) DEFAULT NULL,
`st` varchar(3) DEFAULT NULL,
`dd` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `date` (`adate`)