You should try
Union
for your required result set.
But for that you need to have equal number of columns in both the queries. In your case, both queries should have
worker, product, Issued, received, pro_unitrs, pro_tot columns.
First query :
select (select wor_code from chall_rec_master where rec_id = chall_rec_pro.rec_id) as Worker,
pro_code,
0 as Issued,
sum(pro_qty) as received,
pro_unitrs,
pro_tot
from chall_rec_pro group by pro_code
Second query:
select (select worker_code from challan_master where challan_id = challan_mast_prod.challan_id) as Worker ,
pro_code,
sum(pro_qty) as Issued ,
0 as received,
0 as pro_unitrs,
0 as pro_tot
from challan_mast_prod group by pro_code
Final Query:
select (select wor_code from chall_rec_master where rec_id = chall_rec_pro.rec_id) as Worker,
pro_code,
0 as Issued,
sum(pro_qty) as received,
pro_unitrs,
pro_tot
from chall_rec_pro group by pro_code
UNION
select (select worker_code from challan_master where challan_id = challan_mast_prod.challan_id) as Worker ,
pro_code,
sum(pro_qty) as Issued ,
0 as received,
0 as pro_unitrs,
0 as pro_tot
from challan_mast_prod group by pro_code
Please check if this works.
Thanks,
Lok..