-- use traffic;
explain
select
	ifnull(out.psizeSum,0) as outTraf,
	ifnull(in.psizeSum,0) as inTraf
from
	(
		select sum(psize) as psizeSum
		from traffic
		where (date >= "2009-07-01" and date < "2009-07-02")
			and srcPort = 0
	) as `out` join
	(
		select sum(psize) as psizeSum
		from traffic
		where (date >= "2009-07-01" and date < "2009-07-02")
			and dstPort = 0
	) as `in`;
