searchsanjaysharma
asked on
How to join multiple tables with aggregated outout.
I am using this command given by one of the experts to get the desired output on the basis of state,district,source.
Here there is only 2 tables.Similarly i want to append the result from other tables say t1 and t2 to this query, joining to be done on same fields.
select state,district,source,
count(
CASE
WHEN rfeeddate between '2012-3-1' and '2012-3-31' THEN 1
ELSE NULL
END) as cnt,
count(
CASE
WHEN rfeeddate<='2012-3-31' THEN 1
ELSE NULL
END) as cntTill
from mstchvs where flagr=1 and
group by state,district,source
order by 1,2,3
Here there is only 2 tables.Similarly i want to append the result from other tables say t1 and t2 to this query, joining to be done on same fields.
select state,district,source,
count(
CASE
WHEN rfeeddate between '2012-3-1' and '2012-3-31' THEN 1
ELSE NULL
END) as cnt,
count(
CASE
WHEN rfeeddate<='2012-3-31' THEN 1
ELSE NULL
END) as cntTill
from mstchvs where flagr=1 and
group by state,district,source
order by 1,2,3
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok
ASKER