i want to display the sum of aftertax value in the contract pricing schedule
when i select current month and year or particular year and month ,i want to display sum of previous month and year values in te aftertax field
i wrote two sql queries but i dont know how to write two queries in to one query.
if i combined these two queries it display unsupproted search query
please help me how to combined and display sum of the after tax
select custrecord_ctr_rev_recog_sched_date as revstartdate,\
custrecord_njt_rev_reg_after_tax as qualrevperiod,\
BUILTIN.DF(custbody_njt_sales_prop_name) as building, \
BUILTIN.DF(custbody_njt_sales_unit) as unitcode,\
B.foreigntotal as spavalue,\
BUILTIN.DF(B.custbody_njt_contract_type) as contracttype,\
BUILTIN.DF(custbody_njt_contract_status_tran) as contractstatus,\
BUILTIN.DF( A.custrecord_transaction_link_field) as contractno,\
B.trandate as invoicedate,\
BUILTIN.DF(D.Name) as unittype,\
BUILTIN.DF(X.entitytitle) as customername,\
A.custrecord_transaction_link_field as contractid,\
from customrecord_njt_revenue_recog_schedule A inner join transaction B on B.id= A.custrecord_transaction_link_field inner join item C on C.id= B.custbody_njt_unit_\
inner join customer X on X.id= B.entity \
left join customlist859 D on D.id = C.custitem_njt_um_type \
left join customlist_njt_contract_status_tran E on E.id = B.custbody_njt_contract_status_tran where C.custitem_njt_um_type =1 {{contractCondition}} {{monthCondition}} {{contracttypeCondition}} {{cutomernameCondition}} {{unitnameCondition}} {{buildingnameCondition}} {{ContractstatusCondition}} ";
" select sum(custrecord_njt_rev_reg_after_tax) as revearlyperiod,\
A.custrecord_transaction_link_field as contractid,\
from customrecord_njt_revenue_recog_schedule A \
inner join transaction B on B.id= A.custrecord_transaction_link_field \
inner join item C on C.id= B.custbody_njt_unit_\
inner join customer X on X.id= B.entity \
left join customlist859 D on D.id = C.custitem_njt_um_type \
left join customlist_njt_contract_status_tran E on E.id = B.custbody_njt_contract_status_tran \
where C.custitem_njt_um_type =1 and custrecord_ctr_rev_recog_sched_date < '" + StartDate + "' \
and A.custrecord_transaction_link_field = '" + Contractid + "' group by A.custrecord_transaction_link_field ";