SQL SERVER 怎么写

nhudailiming 2018-05-02 02:09:17



sqlserver 怎么写
...全文
1261 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
一个烤羊腰子 2018-06-11
  • 打赏
  • 举报
回复
select * from 表a where id=1 and name=1 select * from表 a inner join b on a.id=b.id and a.name=b.name
cxmcxm 2018-05-27
  • 打赏
  • 举报
回复
用exists代替
shinger126 2018-05-24
  • 打赏
  • 举报
回复
MSSQL的in和not in只能用于一个列。多个列判断的话,要用exists或者not exists
ycj80 2018-05-23
  • 打赏
  • 举报
回复

--通过子查询,取到group 的数据,再关联原表。
select * 
From t_gm_scoreTotalAnalysis a
join (select classType,subjectId,MAX(averageScore)averageScore
	from  t_gm_scoreTotalAnalysis 
	where kslc='1'
	group by classType,subjectId) b 
	on a.classType=b.classType and a.subjectId=b.subjectId and a.averageScore=b.averageScore
where kslc='1'

vinny_z 2018-05-10
  • 打赏
  • 举报
回复
没明白你的需求,
SELECT * FROM a WHERE id = 1 AND name = '1'
在路上_- 2018-05-09
  • 打赏
  • 举报
回复

select * from a t1
where exists (select 1 from a t2 where t2.id=t1.id and t2..name=t1.name)
nhudailiming 2018-05-07
  • 打赏
  • 举报
回复
A.id=id and A.name=name) 是 一个集合的组合 不止 一个单值
卖水果的net 版主 2018-05-04
  • 打赏
  • 举报
回复
看楼主的意思,是要报 soruce 最大的那些记录。 可以使用 row_number(有相同 source 的话,可以用 rank) 函数。
RINK_1 2018-05-04
  • 打赏
  • 举报
回复
不知道你最终想要实现什么结果,看你的逻辑,觉得没意义。

select * from a as A
where exists (select 1 from a where A.id=id and A.name=name)
debugLQ 2018-05-04
  • 打赏
  • 举报
回复
select * from AA where AA.s in (...) and AA.b in (...)
surl61240 2018-05-02
  • 打赏
  • 举报
回复
如果只有一张表,直接 select * from a where id=1 and name=1 如果是两张表: select a.* from a inner join b on a.id=b.id and a.name=b.name
nhudailiming 2018-05-02
  • 打赏
  • 举报
回复
mysql 可以这么写 , sqlserver 怎么写?

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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