借用一樓的查詢語句,他查出來是一條數據,這是個首行首列的,然後用把這個值提出來,控制項賦值就行了,比如控制項是lable,即就是 label1.Text=(此處放那個值)。我也不知道是不是你的那個意思,如果覺得對著,代碼方面有問題,可以繼續追問,如果意思不對你的那個,那就愛莫能助了。
『貳』 access中怎樣讓表格中的數據自動求和
1、打開一個Access資料庫軟體,可以看到資料庫左邊的文件目錄,滑鼠左鍵單擊【表格】選項。
『叄』 SQL資料庫求和
select 姓名 as 姓名,max(case 課程 when'語文' then 分數 else 0 end)語文,max(case 課程 when'數學' then 分數 else 0 end)數學,max(case 課程 when'物理' then 分數 else 0 end)物理 from tb group by 姓名
union all
select '' 姓名 ,sum(語文),sum(數學),sum(物理) from (
select 姓名 as 姓名,max(case 課程 when'語文' then 分數 else 0 end)語文,max(case 課程 when'數學' then 分數 else 0 end)數學,max(case 課程 when'物理' then 分數 else 0 end)物理 from tb group by 姓名
) a
『肆』 asp 從資料庫提取出數據後如何合計
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="SELECT * from td_jd_cx"
rs.open sql,conn,1,1
%>
<%
set rs1=server.createobject("adodb.recordset")
sql="SELECT * from td_jds"
rs1.open sql,conn,1,1
%>
<%
set rs2=server.createobject("adodb.recordset")
sql="SELECT * from td_mr_cx"
rs2.open sql,conn,1,1
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
<!--
@import url("emx_nav_left.css");
-->
</style>
<link href="emx_nav_left.css" rel="stylesheet" type="text/css" media="all" />
<style type="text/css">
<!--
.STYLE1 {font-weight: bold}
body {
background-image: url(images/4296762_091712076313_2.jpg);
}
-->
</style>
</head>
<body>
<div id="pagecell1">
<div id="pageName">
<h2>團隊業績一覽表</h2><%response.write now()%>
</div>
<table width="100%" border="1">
<tr>
<th class="storyLeft" scope="row">序號</th>
<td bgcolor="#CCCCCC" class="storyLeft">團隊</td>
<td bgcolor="#66CCFF" class="storyLeft"><strong>當日</strong></td>
<td bgcolor="#00CCFF" class="storyLeft">百分比</td>
<td class="storyLeft">階段任務</td>
<td class="storyLeft">階段數</td>
<td class="storyLeft">百分比</td>
<td class="storyLeft">全年任務</td>
<td class="storyLeft">全年數</td>
<td class="storyLeft">百分比</td>
</tr>
<tr>
<%
'***********************************
'整體來說不知道你這個是怎麼合計的,所以只是給個想法
'***********************************
'定義一些變數
dim dlCount,dlljCount '當日量統計,當日累計統計變數
dlCount = 0
dlljCount = 0
'這個百分比我不知道怎麼取得的自己定義吧
do while not rs.eof
'進行累計一下
dlCount = dlCount + rs("td_m")
dlljCount = dlljCount + rs("當日累計")
%>
<th scope="row"><%=rs("td_id")%></th>
<td bgcolor="#CCCCCC"><%=rs("td_m")%></td>
<td bgcolor="#66CCFF"><strong><%=rs("當日累計")%></strong></td>
<td bgcolor="#00CCFF"><% response.write int(rs("完成比例")*10000)/100 %>%</td>
<td><%=rs1("td_jds")%></td>
<td><%=rs1("階段累計")%></td>
<td><% response.write int(rs1("完成比例")*10000)/100 %>%</td>
<td><%=rs2("td_zs")%></td>
<td><%=rs2("階段累計")%></td>
<td><% response.write int(rs2("完成比例")*10000)/100 %>%</td>
</tr>
<%
rs.movenext
rs1.movenext
rs2.movenext
loop
%>
<tr>
<th colspan="2" scope="row">合計</th>
<td><%=dlCount%> </td>
<td> <%=dlljCount%></td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
</body>
</html>
<%
rs.close
rs1.close
rs2.close
set rs=nothing
set rs1=nothing
set rs2=nothing
conn.close
set conn=nothing
%>
肯定能實現,加一個判斷就行了,如果為空就不想加就是了
『伍』 mysql資料庫有兩列數據,怎麼求和,具體看詳情!
select sum(case b is null when a else b end) from table;
『陸』 SQL資料庫里的求和語句怎麼寫
用select sum(列名),sum(列名),sum(列名)…… from 表 where 條件。
『柒』 asp 從資料庫提取出數據後如何合計
代碼一堆沒細看,提個意見:直接在sql裡面:select count(*) from ... ....(記錄行數)
select sum(成績) from ... ....(求總成績)
『捌』 怎麼把兩列的數據求和(先每列求和,再把結果再相加)sql資料庫
1、在數據中打開一個存在整數數值的表,然後可以看到右下角就有查看的表格數據。
『玖』 如何用sql語句將資料庫表中欄位內容中的數值進行求和
我把邏輯演算法告訴你 ,語句你就自己寫了。用replace函數 去掉對應的字元
例如:select replace(replace(欄位,'尊敬……金額',''),'元……變化','')
使用兩次REPLACE 第一次去掉前面的字元,第二次去掉後面的字元,只剩下數字了,再格式化這串數字為數值,不然語句出來只是個字元串