在ASP中怎么计算某个字段有多少种不同的记录?

来源:百度知道 编辑:UC知道 时间:2024/05/22 13:37:14
根据这个:
<%
Set rs1 = Server.CreateObject("ADODB.Recordset")
rs1.Open "Select cwhcode From peisongproduct WHERE sbvcode='"&request.QueryString("sbvcode")&"'" , conn_ceshi,3,3
%>
查询出数据库符合条件的cwhcode字段有多少记录?

谁有比较好的方法?
并且能把这写不同的记录列出来???

distinct

查有多少个可以用
rs1.Open "Select count(cwhcode) From peisongproduct WHERE sbvcode='"&request.QueryString("sbvcode")&"'" , conn_ceshi,3,3

列出多少个可以用
rs1.Open "Select distinct cwhcode From peisongproduct WHERE sbvcode='"&request.QueryString("sbvcode")&"'" , conn_ceshi,3,3

可以用这句来列出条数并显示不同的
rs1.Open "Select distinct cwhcode ,count(cwhcode), From peisongproduct WHERE sbvcode='"&request.QueryString("sbvcode")&"'" , conn_ceshi,3,3

EASY
你的程序不动
rs1.recordcount 就是计录数了
do until rs1.eof
response.write rs1.fields("cwhcode") & "<br>"
rs1.movenext
loop