28,391
社区成员
发帖
与我相关
我的任务
分享
<%
set rs=conn.execute("select * from [a]")
do while not rs.eof
set rrrr=conn.execute("select sum(hit) as zhongfen from [b] where a_id="&rs("id"))'总和
response.Write""&rs(title)&":"&rrrr("zhongfen")&"<br />"
rs.movenext
%>
SELECT DISTINCT a.title, SUM(b.hit) AS expr1
FROM tt1 a INNER JOIN
tt2 b ON a.id = b.a_id
GROUP BY a.title
ORDER BY expr1 DESC
SELECT DISTINCT a.title, SUM(b.hit) AS expr1
FROM tt1 a INNER JOIN
tt2 b ON a.id = b.a_id
GROUP BY a.title
ORDER BY a.title DESC
select tablea.title,sum(tableb.hit)as hit from a tablea INNER JOIN b tableb ON tablea.id = tableb.a_id GROUP BY tablea.title order by hit desc