那如果我想要取排名后几位的该怎么写呢?

TOP是取排名前的
如 select top 30* from table

潇潇雨雨
浏览 76回答 2
2回答

慕仙森

比如a.asp:<%haha=request.querystring("haha")Set rs = Server.CreateObject("ADODB.Recordset")sql=select * from data where words='"&haha&"' order by hits desc"rs.open sql,conn,1,1%><html><font color=red><%=rs("words")%><font color=blue><%=rs("hits")%>go.asp:<form action=a.asp method=get><input type=text name="haha"><input type=submit value=提交></form>如果我想SQL注入,先提交提个数据比如“我”,这样,提交后,转到页面a.asp地址是这样的:a.asp?haha=wo如果加上a.asp?haha=wo 1=2这样的地址就会出错,如果你没有防范,那么你的数据库、连接方式、表的字段名就会暴露。

森栏

这是通过 order by + desc/asc实现如:以ID为排序列select top 30 * from Table order by ID asc--ID前30select top 30 * from Table order by ID desc--ID后30
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

MySQL