Update matters set debtbal = (select sum(matterledger.valued) from matterledger where matterledger.matter = matters.code),
		   ClientBal = (select sum(matterledger.valuec) from matterledger where matterledger.matter = matters.code),
		   OutlayBal = (select sum(matterledger.valueo) from matterledger where matterledger.matter = matters.code),
		   ClientCurBal = (select sum(matterledger.valueCC) from matterledger where matterledger.matter = matters.code),
  		   ClientDepBal = (select sum(matterledger.valueCD) from matterledger where matterledger.matter = matters.code),
		   TimeBal = (select sum(dbo.TimeEntry.TIME) from dbo.TimeEntry where dbo.TimeEntry.matter = matters.code),
		   ChargeBal = (select sum(dbo.TimeEntry.CHARGE) from dbo.TimeEntry where dbo.TimeEntry.matter = matters.code)
Update Nominal set balance = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code),
		Month1 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=1),
		Month2 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=2),
		Month3 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=3),
		Month4 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=4),
		Month5 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=5),
		Month6 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=6),
		Month7 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=7),
		Month8 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=8),
		Month9 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=9),
		Month10 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=10),
		Month11 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=11),
		Month12 = (select sum(nominalledger.value) from nominalledger where nominalledger.code = nominal.code and nominalledger.per=12)

Update suppliers set balance = (select sum(supplierledger.osvalue) from supplierledger where supplierledger.supp = suppliers.code)

Update Contacts set BillBal = (select sum(matters.debtbal) from matters where matters.clientcode = contacts.code),
		OutlayBal = (select sum(matters.outlaybal) from matters where matters.clientcode = contacts.code),
		ClientCur = (select sum(matters.clientCurBal) from matters where matters.clientcode = contacts.code),
		ClientDep = (select sum(matters.clientDepBal) from matters where matters.clientcode = contacts.code)




