越王墓博物馆附近美食:一个关于ASP的问题!很急!

来源:百度文库 编辑:神马品牌网 时间:2024/05/05 16:41:54
现在我想实现数据库中D_unit字段里的记录集里面只要有重复相同的两个数据在页面中显示为黄色,相同的三个或者三个以上的在页面中显示为红色,这样的代码应该怎么写啊?
路过的大哥大姐们请帮帮忙!
我试了,还是不行。。。
我以前的语句是这样写的:
sql="select userdata.*,usercheck.* from userdata,usercheck where userdata.D_userID=usercheck.U_name and D_userID='"+request("id")+"' order by "+ord+" desc"
怎么套嵌到你说的语句里面啊?能不能讲详细些,谢谢了!

sql="select a.*,(select count(*) from tablename b where b.d_unit=a.d_unit) as d_count from tablename a"
'处理的时候把tablename都换成你实际的表名称即可

....'数据链接,建立记录集等过程

do while not rs.eof
if rs("d_count")=2 then
'两个重复要怎么显示..
elseif rs("d_count")>2 then
'三个(含)以上的要怎么显示
else
'只有一个的怎么显示...
end if
rs.movenext
loop
...