sql问题,请 上次回答的zjcxc(邹建)等入!

oneofcsdn 2003-10-21 12:34:55
http://expert.csdn.net/Expert/topic/2365/2365279.xml?temp=.7292292

如果我的表中还有一个c列,我还要加个限定条件,例如c=1,如何加?

select * from tablea aa
where (select sum(1) from tablea where a=aa.a)>1 and b=1) or (select sum(1) from tablea where a=aa.a)=1
...全文
41 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengdali 2003-10-21
  • 打赏
  • 举报
回复
select * from a tem where b=(select max(b) from a where a=tem.a)

加c=1:

select * from a tem where b=(select max(b) from a where a=tem.a and c=1) and c=1
oneofcsdn 2003-10-21
  • 打赏
  • 举报
回复
谢谢偶像!!!

22,206

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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