ZKX's LAB

数据库置顶 帖子置顶,SQL语句,数据库表的设计

2020-10-09知识8

【急】如何只显示最新一条置顶的信息 其余的按照id来排序 数据库添加一个字段top,用来标识置顶,数据库查的时候就select*from a ORDER BY top ASC,id DESC不行的话你就两个sql来实现就行了。一个是最新的置顶信息,另一个是按id排序取出的数据

数据库置顶 帖子置顶,SQL语句,数据库表的设计

红米 Redmi K20 和 Redmi K20 Pro 的实际体验如何? https:// gp.qq.com/d/sns.html123(二维码自动识别) ? 325 ? ? 111 条评论 ? ? ? 喜欢 ? 继续浏览内容 知乎 发现更大的世界 打开 Chrome 继续 1。

数据库置顶 帖子置顶,SQL语句,数据库表的设计

求一句aspp写的代码 1、在数据库中加置顶这个字段,如果置顶,那么值为1,普通的为0这样选择的时候select*from 表 order by 置顶 desc,时间2、如果能确定这两条的标识字段值,那么就这么写假如是3和4select*from(select*,'1' as zd from 表 where id=3 or id=4 UNION(select*,'0' as zd from 表 where id<;>;3 or id<;>;4))as d order by zd desc,时间 desc补充:是否能够确定你要置顶的那两条数据的SMT_id?我这里假设你能够确定,并且假如值是3和5set rs=server.createobject(\"adodb.recordset\")sql=\"select top 12*from(select*,(case SMT_id when 3 then 1 when 5 then 1 else 0 end)as zd from SMT_news)as temptb where SMT_key=1 and SMT_key1=1 and SMT_key2=1 and SMT_key3=1 order by zd desc,SMT_id desc中间的when 3和when 5中的数字变成你确定的那两条的SMT_id值就可以了rs.open sql,conn,1,1do while not rs.eoftitle=trim(rs(\"SMT_title\"))if cityHTML=1 thenwebget=\"Html/news/\"&year(rs(\"SMT_date\"))&month(rs(\"SMT_date\"))&\"/\"&replace(replace(replace(rs(\"SMT_date\"),\"-\",\"\"),\":\",\"\"),\"\",\"\")&\".htmlelsewebget=\"ypnew_view.asp?id=\"&rs(\"SMT_id\")&\"end。

数据库置顶 帖子置顶,SQL语句,数据库表的设计

#数据库#微信运动#select

随机阅读

qrcode
访问手机版