My database has table title transactions that has 20000 records. After i run this question

SELECT T1.* FROM transactions AS T1
WHERE T1.ppno IN 
  (SELECT T2.PPNO FROM transactions AS T2 
   WHERE T2.ppno = T1.ppno 
   HAVING COUNT(T2.ppno) = $doublescount) 
 ORDER BY T1.ppno,T1.numb

it requires atleast 3 mins to operate....How you can accelerate this question. Plz help

EDIT 1: show create table transactions returns as

CREATE TABLE `transactions` (
  `eidx` int(10) unsigned NOT NULL,
  `numb` int(10) unsigned NOT NULL,
  `date` date NOT NULL,
  `time` varchar(45) NOT NULL,
  `name` varchar(45) NOT NULL,
  `add1` varchar(45) NOT NULL,
  `add2` varchar(45) NOT NULL,
  `city` varchar(45) NOT NULL,
  `phno` varchar(45) NOT NULL,
  `nati` varchar(45) NOT NULL,
  `ppno` varchar(45) NOT NULL,
  `cuam` varchar(45) NOT NULL,
  `tcam` varchar(45) NOT NULL,
  `valu` varchar(45) NOT NULL,
  `srch` varchar(45) NOT NULL,
  `stax` varchar(45) NOT NULL,
  `taxp` varchar(45) NOT NULL,
  `roun` varchar(45) NOT NULL,
  `amnt` varchar(45) NOT NULL,
  `encd` varchar(45) NOT NULL,
  `mocd` varchar(45) NOT NULL,
  `endt` varchar(45) NOT NULL,
  `modt` varchar(45) NOT NULL,
  `sflg` varchar(5) NOT NULL,
  `category` varchar(45) NOT NULL DEFAULT 'NA',
  `branch` varchar(10) NOT NULL,
  PRIMARY KEY (`numb`,`branch`,`date`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED

Subqueries are slow. Make use of a JOIN on the temporary table that contains all of the ppno's that fulfill the condition.

SELECT T1.* FROM transactions AS T1 
JOIN (SELECT DISTINCT T2.PPNO FROM transactions AS T2 HAVING COUNT(T2.ppno) = $doublescount) AS temp ON temp.PPNO=T1.ppno
ORDER BY T1.ppno,T1.numb

When the bottleneck may be the database, you may also omit an order BY and perform the ordering within the application rather than the DB.

alter the SELECT T1.* FROM transactions AS T1 therefore it brings just the posts you'll need e.g SELECT T1.ppno, T1.name FROM transactions as T1 after which make use of the join method thanks to Gerben.

when SELECT * can be used, the database system needs to exercise what posts have been in the database, after which allocate memory for every column and row - a great deal of research prior to the totally run. By utilizing named posts, the database system only must check individuals posts - less research before you run the query.

In case your totally taking 3mins to complete, you most likely possess a cartesian join happening, in which the result set may potentially encounter the millions. gerben's join method prevents this by looking into making a brief table composed from the subquery result appended towards the primary table, the primary totally run from this temporary table to make a much more compact result set.