请教大师一个sql语句,查询数据,除去某一个条件

2024-12-04 11:14:59
推荐回答(5个)
回答1:

如果是SQL Server
则为:
select top(5) * from Dv_bbs1 where RootID = 21445 and username!=roger;
如果是MYSQL
select * from Dv_bbs1 where RootID = 21445 and username!=roger limit 0,5

回答2:

select top 3 mdg,count(mdg) cont,qd,hx from HxTable
where Qsg ='青岛' group by mdg,qd,hx
order by count(mdg) desc
也不知道你的 HxTable表什么样子,随便写了个,没测试。

去这里学习一下吧,里面资料很全面。看过之后相信你自己能解决问题!
加油

回答3:

SELECT * FROM Dv_bbs1
WHERE RootID = 21445
AND UserName <> 'roger'

回答4:

SELECT * FROM Dv_bbs1
WHERE (RootID = 21445 and USERNAME<>'roger')

回答5:

select * from Dv_bbs1 where RootID = 21445 and username = roger