作者kero961240 (kobe)
看板Database
标题[SQL ] SQL 多个复杂查询串接问题
时间Fri Mar 11 23:59:47 2022
资料库名称: SQL SERVER
资料库版本: 2016
内容/问题描述:
各位前辈好,小弟目前在工作上遇到此需求
现在有一个 TABLE tbStudent
当中的三个栏位 name chinese math
小弟想拉出 name = a chinese = 90 math = 80
name = b chinese = 78 math = 96
请问语法该如何串接呢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 223.139.208.242 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Database/M.1647014389.A.1A3.html
1F:→ Iories: where name+chinese+math in ('a9080','b7896') 03/12 07:29
2F:→ Iories: 若有型别问题再用convert转换一下 03/12 07:30
3F:→ MOONY135: .....工作上这样用吗.... 03/14 09:48
4F:推 alpho: 用TVP join 试试看? 03/22 10:38
5F:→ alec65: select name,chinese=Max(chinese),math=Max(math) from 03/22 11:04
6F:→ alec65: tbStudent group by name 03/22 11:04
7F:→ vul81320: 奇怪..只有我看不懂你的条件到底是什麽吗? 05/23 11:51