Select a.*,
(select namagol from tm_golongan where kodegol=a.kodegol) as namagol,
 (select sum(stockakhir) from tm_stockbrg where kodebrg=a.kodebrg) as stockakhir,
 (select namasupp from tm_supplier where kodesupp=a.kodesuppB) as namasupp, 
(select namagd from tm_gudang where kodegd=a.defaultgdbeli) as namagdbeli, 
(select namagd from tm_gudang where kodegd=a.defaultgdjual) as namagdjual 
from tm_Barang a where (1=1 
 and aktif='Y'
 and namabrg like '%BAJ%'
)
 order by namabrg
