Lot of thanks for your response.
I use use your code like this.
dim totalBH, total2, totalMH1, per
IF NOT RS.EOF THEN
do while rs.eof=false
Response.Write("<td align=center>" & rs("empno") & "</td>")
Response.Write("<td align=center>" & rs("projno") & "</td>")
totalBH = (totalBH + cint(rs("BH")))
Response.Write("<td align=center>" & rs("BH") & "</td>")
totalMH1 = (totalMH1 + cint(rs("MH1")))
Response.Write("<td align=center>" & rs("mh1") & "</td>")
.......
total2 = (total2 + cint(rs("total")))
Response.Write("<td align=center>" & rs("total") & "</td>")
Response.Write("<td> </td>")
rs.movenext
loop
per = (total2/totalBH)*100
per=round(per,2)
Response.Write "<tr>" & _
"<td colspan='3'> </td>" & _
"<td align=center>" & totalBH & "</td>" & _
"<td align=center>" & totalMH1 & "</td>" & _
"<td> </td>" & _
"<td> </td>" & _
"<td> </td>" & _
"<td> </td>" & _
"<td align=center>" & total2 & "</td>" & _
"<td align=center>" & per & "</td>" & _
"<tr>"
end if
I use following query with group by
ssql="select a.projno, e.Name, e.dept,a.empno,b.dated,b.bh, sum(total) total
.....
where b.dated='"& DATED &"' and
a.projno='"& projno &"'
group by a.projno ,e.dept,e.name,a.empno,b.bh,b.dated
order by e.DEPT,E.NAME,a.projno"
data display in asp page like this.
date:4/27/2005
empno..dept...projno....BH......total....
-------------------------------------------------------------
12345...highway..2016.....200...100
45612...highway..2016.....170...150
12349...highway..2016.....200...100
56545...Account..2016.....250...110
56444...Account..2016.....200...150
21545...Account..2016.....150...100
--------------------------------------------------------------
.....................................1170...710
I want to retrieve data and calculation in asp page like this with calculation
date:4/27/2005
empno..dept...projno......BH......total...&Utilize d.
------------------------------------------------------
12345...highway..2016.....200...100
45612...highway..2016.....170...150
12349...highway..2016.....200...100
.....................................570....350... .61.40
56545...Account..2016.....250...110
56444...Account..2016.....200...150
21545...Account..2016.....150...100
--------------------------------------------------
.....................................600....360... .61.40
350/570*100=61.40
360/600*100=60.00
1. display sum/total with department wise and also calculate
%Utilized as above ?
2. what change in asp loop, it display data as above ?
3. or what change in sql query that it display data as above ?
4. or how can use the query in above loop that it display
data department wise ?
Please help.
regards.
Mateen
|