hi
i created one query to get total amount from different table
here is my query
@Name varchar(50)
AS BEGIN SET NOCOUNT ON;
Select tblAssetUnits.untCharges,tblAssetUnits.untFlat,tblCharge.cValue,tblCharge.cGheID,tblCharge.cID,tblGeneralHeader.gheChargeName,
(select sum(cValue)from tblCharge where tblCharge.cGheID=tblAssetUnits.untCharges)
from tblAssetUnits
Inner join
tblCharge on tblAssetUnits.untCharges=tblCharge.cGheID
left outer join tblGeneralHeader on tblAssetUnits.untCharges=tblGeneralHeader.gheID
where tblAssetUnits.untFlat like @Name+'%'
order by tblAssetUnits.untFlat
END
in this line i want to do some changes
(select sum(cValue)from tblCharge where tblCharge.cGheID=tblAssetUnits.untCharges)
tblCharge contains
cGheID int
cApplication varchar(50)
cID int Unchecked
cChargeDetails varchar(50)
cFactor int Checked
cValue decimal(18, 4)
cDelStatus bit
and tblAssetUnits
untAssetUnitID int
untDescription varchar(100)
untFlat varchar(50)
untTypeID int Checked
untArea decimal(18, 4)
untUnits varchar(50)
untBR varchar(50)
untBathRoom varchar(50)
untGroupID int
unitRate decimal(18, 4)
untFloorPlan varchar(50)
untCharges varchar(50)
1. for ex. for 'Charge one' am adding 4 grid data with Fixed rate and Per Unit rate.
2.In tblAssetUnits am saving tblCharge id in untCharges.
3.Sum should calculate like in tblCharge cApplication is dropdown to select Fixed or PerUnit
4.here to sum like if it is Per Unit then cValue(tblCharge.cApplication is Per unit then tblAssetUnits.untArea*tblCharge.cValue) and if tblCharge.cApplication is Fixed then tblAssetUnitsuntArea+ tblCharge.cValue)
so how to get sum like this way..am trying difficult..please suggest me.if u have doubt in my question please comment..
hope u understood..
thank you..