Stack Exchange
GET report with Different Where condition
I have a table with fields 
TPI
CLICKS
IMPRESSION
CLASSIFY

I need to get 3 result 
1st) SUM(CLICKS)/SUM(IMPRESSION) * 100 GROUP BY TPI
2nd) SUM(IMPRESSION) WHERE CLASSIFY = "XYZ" GROUP BY TPI
3rd) SUM(IMPRESSION) WHERE CLASSIFY = "ABC" GROUP BY TPI

Desired OP 
TPI 1st_data 2nd_data 3rd_data

WHERE TPI is unique in output 
Can I achive this in single query ?
Thanks in advance

Conditional aggregation should work for you. Use a CASE in the sum()'s argument to only use the value impression when your condition on classify is satisfied.
SELECT tpi,
       sum(clicks) / sum(impression) * 100 1st_data,
       sum(CASE classify
             WHEN 'XYZ'
               THEN impression
             ELSE
               0
           END) 2nd_data,
       sum(CASE classify
             WHEN 'ABC'
               THEN impression
             ELSE
               0
           END) 3rd_data
       FROM elbat
       GROUP BY tpi;

