select top 8 * from Info ORDER BY id desc如何改才能读到具体项
来源:百度知道 编辑:UC知道 时间:2024/06/19 04:21:56
select top 8 * from Info ORDER BY id desc这句把Info所有的信息都读出来了,但我想要Info里面一项sort=42的才显示,sort是其它值的不显示出来。我改成select top 8 * from Info where sort='42' ORDER BY id desc,不能显示。请问有什么办法实现吗?能不能在select top 8 * from Info ORDER BY id desc后面加上判断sort=42的才显示,如果不是就不显示。如果可以,请朋友们帮我补上后面的判断,谢谢。。
还是不行,页面一直在载入中..select top 和where好像不能同时使用,不然会搜索全部数据.能不能不用where,只在后面加个判断语句?
还是不行,页面一直在载入中..select top 和where好像不能同时使用,不然会搜索全部数据.能不能不用where,只在后面加个判断语句?
select top 8 * from Info where LTRIM(sort)='42' ORDER BY id desc 看看是不是就能显示了
select top 8 * from Info where sort=42 ORDER BY id desc
就是这么简单,干嘛还要讨论这么多。
select和where肯定可以一起使用,你的问题也肯定不在这条语句上。
应该可以的。
试试:
select top 8 * from
(select * from Info where Rtrim(Ltrim(sort))='42'
ORDER BY id desc)
我觉得你的意思是选择前8行中sort='42' 的列,如果是这样的话采用嵌套查询吧
select * from (select top 8 * from Info ORDER BY id desc) a where a.sort='42'
select top 8 * from Info where sort=42 ORDER BY id desc
select top 8 * from Info where soft='42' ORDER BY id desc
select top 10 * 问题
SELECT TOP问题
Select top 的问题!!!!!
SELECT TOP 问题 SOS~
select语句有select top n ,有select bottom 吗?
这句什么意思select top 8 * from news ORDER BY id DESC
select top的取数问题
select top 4 * from的JSP问题
SQL语句“SELECT TOP 10”的问题
select top 100 * from [special] where specialID not in (select top 9 specialID 。。。