CREATE TEMPORARY TABLE tmpIMOBILE
SELECT SUBSTRING(DATE,1,10) AS ABC, SUM(amount) AS SELL_IMOBILE
FROM voucherless_alu
WHERE DATE>='2013-02-01' AND DATE<='2013-02-28' AND mvno_id = '21' AND channel LIKE 'SDPCGW1' AND `from` LIKE '%_refill'
GROUP BY ABC;
CREATE TEMPORARY TABLE tmpTOT
SELECT SUBSTRING(DATE,1,10) AS ABC, SUM(amount) AS SELL_TOT
FROM voucherless_alu
WHERE DATE>='2013-02-01' AND DATE<='2013-02-28' AND mvno_id = '11' AND channel LIKE 'WEBTOT3G'
GROUP BY ABC;
CREATE TEMPORARY TABLE tmpLOXLY
SELECT SUBSTRING(DATE,1,10) AS ABC, SUM(amount) AS SELL_LOXLY
FROM voucherless_alu
WHERE DATE>='2013-02-01' AND DATE<='2013-05-28'
AND mvno_id = '41'
AND channel = 'SDPCGW1'
AND `from` = 'refill'OR'Loxley Adjustment'
AND check3 LIKE 'KBM%'
GROUP BY ABC;
SELECT tmpTOT.ABC, SELL_TOT, SELL_IMOBILE, SELL_LOXLY
FROM `tmpIMOBILE`, `tmpTOT`,`tmpLOXLY`
WHERE tmpTOT.ABC = tmpIMOBILE.ABC AND tmpTOT.ABC = tmpLOXLY.ABC;