Untitled

                Never    
SQL
       
select taikhoan_sotien.*, RIGHT(LEFT(tkdu,2),1) as muc_tk, SUBSTRING(tkdu, 2,len(tkdu)) as ma_tk, SUBSTRING(tkdu, 1, 1) as loai_tk
		from
		(select tc.tkdu, sum(tc.st) as st
		from thuchi2015 tc
		group by tc.tkdu
		union all
		select bh.TKDU, sum(bh.ST) as st
		from banhang2015 bh
		group by bh.TKDU
		union all 
		select nh.TKDU, sum(nh.ST) as st
		from nhaphang2015 nh
		group by nh.TKDU) as taikhoan_sotien

Raw Text