Help speed this MySQL query which is taking too long because of an aggregate function
- by Joseph
Hi all,
I am using a following query in MySQL for fetching data from a table. Its taking too long because the conditional check within the aggregate function.Please help how to make it faster
SELECT testcharfield
, SUM(IF (Type = 'pi',quantity, 0)) AS OB
, SUM(IF (Type = 'pe',quantity, 0)) AS CB
FROM Table1
WHERE sequenceID = 6107
GROUP BY testcharfield