加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

sqlserver 部分查询语句记录

发布时间:2020-12-12 14:44:56 所属栏目:MsSql教程 来源:网络整理
导读:1,select Id,SongName,UpTime,TypeId,ImgPath,ClickCount,CommentCount,UserName from MV where? UserName=' + @strWhere + ' or Id in (select MvId from AddMvFav where Name=' + @strWhere + ' 查询所有符合条件的用户上传的视频或者用户收藏的视频 2,c
1,select Id,SongName,UpTime,TypeId,ImgPath,ClickCount,CommentCount,UserName from MV

where? UserName=' + @strWhere + ' or Id in (select MvId from AddMvFav where Name=' + @strWhere + '

查询所有符合条件的用户上传的视频或者用户收藏的视频

2,case when 筛选条件

select count(*),(case when Name in(select top(3) UserName from Singer where State=1 order by Grade desc) then Name else null end) as name from AddMvFav

3,屏蔽除数为0的情况

select * from MV where IsOurSoter=1 order by case?? when?? Grade/CommentCount> 0?? then?? Grade/CommentCount?? else?? Grade?? end? desc

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读