很难的问题,高手请帮忙

garry2000 2007-02-10 10:19:32

select * from usercompanyproduct where ucid in(4,4,4,9,7)
这是我的一条语句,我想让他显示五条,可是只能显示三条,可不可以让他显示五条
...全文
132 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jinanjiang 2007-02-10
  • 打赏
  • 举报
回复
学习中
Andy-W 2007-02-10
  • 打赏
  • 举报
回复
当然只能显示3条了,因为ucid =4存在重复.
要是想显示多条,只有重新构造查询语句了,可以考虑使用动态SQL语句
dawugui 2007-02-10
  • 打赏
  • 举报
回复
select * from usercompanyproduct where ucid = '4'
union all
select * from usercompanyproduct where ucid = '4'
union all
select * from usercompanyproduct where ucid = '4'
union all
select * from usercompanyproduct where ucid = '7'
union all
select * from usercompanyproduct where ucid = '9'

27,581

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧